Passing REINSTALLMODE to MSI file

I use VisualStudio2005 and vdproj to create a simple MSI file. I need to pass the REINSTALLMODE property when I run it.

I know that this can be done through the command line, for example: msiexec.exe /i foo.msi REINSTALLMODE=amus

However, if the user selects msi directly (starting the wizard), the property is not passed. Can this be done with VS and vdproj?

Some parameters that I explored:

  • When I create MSI via VS, it also creates the setup.exe file. Is there a way to pass the REINSTALLMODE property through this is possible?
  • I installed Orca, which allows me to view / edit the MSI property table. I could add it this way, but then I have to add it every time I create an MSI assembly.

Thanks for any advice.

+6
windows-installer deployment vdproj
source share
2 answers

Unfortunately, I cannot find a way to set other MSI properties directly in VStudio.

However, one of the methods that should work is as follows:

  • Use Orca to create a transform (MST) that only modifies the REINSTALLMODE property. (In short, you are editing the property and saving it as a new transformation, then use the "Generate Transform" command to create the MST.)
  • This conversion can be applied directly to your MSI using the MSITRAN.EXE command (available in the same Windows installer SDK where you found Orca).
  • You can: (a) find a way for Visual Studio to always launch your MSITRAN command immediately after building the MSI, or (b) just start your MSITRAN manually (from a batch file or such) after the build, but before testing.
+4
source share

I found a more automatic way to do this.

Create a script called add_reinstall_prop.vbs (example) using the following:

 set objArgs = WScript.Arguments set o_installer = CreateObject("WindowsInstaller.Installer") set o_database = o_Installer.OpenDatabase(objArgs(0), 1) s_SQL = "INSERT INTO Property (Property, Value) Values( 'REINSTALLMODE', 'amus')" set o_MSIView = o_DataBase.OpenView( s_SQL) o_MSIView.Execute o_DataBase.Commit 

Add the post-build event to the installation project by calling the script, with the following:

 add_reinstall_prop.vbs $(BuiltOuputPath) 

This will automatically add the desired entry to the integrated MSI. You can then check this with Orca to see that the record is now automatically added after the build.

+7
source share

All Articles