I recently needed to modify an installation MSI for a website deployment. The "Installation Address" dialog box for a website install doesn't allow customization except for the bitmap, which isn't particularly useful. I needed to modify the default app pool to prevent installation problems.
There are several ways to do this. You can use Orca to open the MSI file and add the property. You can use msiexec.exe from the command line and specify what property you want set. What I wanted was to create a standalone MSI file that did this automatically when the MSI was run.
Using the code
The solution I came up with is to add a post-build event to the setup project. To do this, you'll use Cscript and WiRunSQL.vbs.
The first step is to find Cscript.exe, which for me was located in :
The second step is to find WiRunSQL.vbs which I put in C:\ for simplicity:
To construct the MSI, use the following code to get the correct output. It adds the filename by itself so it's really the path + filename. No need to specify the name of the MSI file.
The last part you'll need is the insert command itself. All the punctuation marks are required. Also keep in mind that the only part you'll need to change is the underlined part:
"INSERT INTO `Property` (`Property`,`Value`) VALUES ('TARGETAPPPOOL','TheAppPoolName you want to use')"
Points of Interest
The final step then is to string these four items together into one command, which will look like:
C:\Windows\SysWOW64\Cscript.exe c:\WiRunSQL.vbs $(BuiltOuputPath) "INSERT INTO `Property` (`Property`,`Value`) VALUES ('TARGETAPPPOOL','TheAppPoolName you want to use')"
Pretty simple once you know how to do it, but it's the learning part that's hard. I hope that you find this useful!