How to use custom actions in Visual Studio setup project (MSI) from command line

I’m lately back to development project work. A useful thing I found out during deployment project development. If you want to pass custom properties to your MSI files VIA COMMAND LINE this is how it is done (one caveat here):

  1. Add in the installer UI a page for your parameter (e.g. a single textbox form)
  2. Create some custom action, a sample is shown here: http://msdn2.microsoft.com/en-us/library/49b92ztk(VS.80).aspx (remember to call your custom action with the customActionData parameter, e.g. in this fashion: /targetDirectory=”[TARGETDIR]\” /configfilename=”[CONFIGFNAME]”)
  3. And basically this is it, it works fine in GUI mode… EXCEPT
  4. If you want to run your MSI in a deployment rig (say deploy it in a scripted way to several clients) and you try the “normal” MSIEXEC way to do this, e.g. msiexec /i “file.MSI” YOURPROPERTYNAME=NEWVALUE it does not pickup the new value but stays with the DEFAULT value you provided for the installer. this is described in detail in this thread here (I confirmed this was my issue by running my MSI through ORCA): http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1333720&SiteID=1. However doing an MST on a file in every build is definitely not a nice solution.
  5. To make it work just provide in the UI of the installer for the DEFAULT value of the text box you use to input the parameter: [YOURPROPERTYNAME]  
  6. This means you do not now have a default value when you run in GUI mode, but when you run in command line you can use the syntax msiexec /i “file.MSI” YOURPROPERTYNAME=NEWVALUE
  7. To have some default value I just used the custom action to do the verification in code for me, if end-user does not provide a valid value in the text field.

 

Regarding new MOM things, check out connect.microsoft.com:

a. OM 2007 sizing document has come out, but it is nothing impressive, go and rather have a read at Ian’s blog:http://ianblythmanagement.wordpress.com/2007/04/19/scom-performance-and-scalability/

b. Operations Manager 2007 SDK for RTM version is out on connect.microsoft.com: OpsMgr 2007 SDK and Samples.

Advertisements

~ by alipka on April 20, 2007.

One Response to “How to use custom actions in Visual Studio setup project (MSI) from command line”

  1. Thanks, worked like a charm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: