Use WiX to make update-able and fresh-installable MSI


To update a MSI file (small/minor update), you have to specify command line options like this.

msiexec /i foo.msi REINSTALL=ALL REINSTALLMODE=vomus

When it’s too tedious, you can use IExpress to wrap the MSI file into an executable (EXE). When started, the executable extracts the wrapped MSI and run the specified command line above.

The problem is, however, the command line does not work for a new (fresh) installation. You may not use "REINSTALL=ALL" in the case of fresh install.

Let’s solve it with WiX, the XML based MSI authoring tool.



The basic idea is to remove REINSTALL property by MSI custom action in the case of fresh install.

The first step is to define the custom action for this. The custom action (called CA_DISABLE_REINSTALL) sets the empty string to REINSTALL property.

<CustomAction Id=’CA_DISABLE_REINSTALL’ Property=’REINSTALL’ Value=”/>

The second step is to run the custom action if the application has been installed. You want to specify it in two places (InstallExecuteSequence and InstallUISequence).

  <Custom Action=’CA_DISABLE_REINSTALL’ Sequence=’999′>NOT Installed</Custom>

  <Custom Action=’CA_DISABLE_REINSTALL’ Sequence=’999′>NOT Installed</Custom>

I don’t fully understand the purpose of Sequence=’999′, but it seems to be a right thing.

That’s it. Your MSI now automatically removes the specified REINSTALL property in the case of fresh install.


About Moto

Engineer who likes coding
This entry was posted in Tips. Bookmark the permalink.

Leave a Reply

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

You are commenting using your 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