Saturday, August 29, 2009

Windows Installer Transforms

If you have ever tried to install more than one instance of you application on a single windows machine you probably know that the windows installer permits only one instance of a product code to be installed for a machine or a user. The "brute force" solution is to create a second msi package and use this one for the installation of the second instance. But since the Windows Installer 3.0 there is another option. You can use the transforms feature to install multiple instances of an application using a single msi package. Below I've listed the steps to create and apply a transform using VS and the Windows SDK:
  1. Compile you setup project to generate the base msi package.
  2. Rename the generated msi file to say mykillerapp_base.msi and copy it to another location.
  3. Change the product code (or maybe also the product name) and recompile your setup project.
  4. Copy the first msi package (mykillerapp_base.msi) to the directory with the second msi file generated in previos step.
  5. Run msitran to generate the transform: msitran -g mykillerapp_base.msi mykillerapp.msi setup.mst
  6. Install the first msi package.
  7. Install the second instance: msiexec /i mykillerapp_base.msi TRANSFORMS=setup.mst MSINEWINSTANCE=1
That's it. ;)