Friday, June 1, 2012

Using Orca to set REINSTALLMODE in your MSI to all files

My daily duties typically revolve around building in new features and developing new products in .Net. Eventually though you have to get around to that dirty job of getting what you have built out to your users.

It works on my PC sounds nice, but most clients are looking for a little more than software running on a developers PC.

So once you have built you new piece of software, you gotta get it out to the masses. One of the many ways to do this is using a MSI installer file. Being a lazy developer I am always looking for ways to spend more time building new things, and less time dealing with things like software distribution to users. For small and simple applications there is nothing simpler than a setup project in visual studio. There are other more powerful tools like Wix, but for me they have just been to complex. I am a developer and don't want to spend days figuring out the ins and outs of wix or some other installation tool. Using visual studio I can add a new project, assign the output from your primary application and you are done. The project figures out everything to be included. Configuration files, dll's, content files etc etc. This can be done in just a few minutes.

The simplicity of the Setup projects are one of the problems with them though. On a recent project I could not get my files to update. I would build a version and distribute my MSI. Some of the dll's and the configuration file would not update, even thought the install would complete. After some research I found a property called REINSTALLMODE in the MSI. This by default uses a checksum to determine if a file should update or not. Well for many reasons this did not work for me. So I decided I want to just update all files every time. This way I can ensure my users have the most up to date files. You can set this by running your msi on the command line but that is kinda clunky. I want users to be able to double click on the msi, install it and be on there merry way. No special batch files and command line arguments.

Instead of setting this property in the MSI I am going to show you how to set the Property using ORCA and editing the MSI directly.

The steps are listed below.
1. Build your MSI 2. Open your MSI in Orca. You can get orca from microsoft here You can just drag it right in from your file system.
3. Navigate to the Property table, its in the first column on the left
4. Right Click and select add row 5. Add REINSTALLMODE for name and amus for value
Now your MSI will overwrite all files, instead of by default using the checksum. Because in my experience the checksum just does not work.