How to allow users to install multiple copies of an MSI file?
I want to allow my users to install multiple copies of my application on a single PC; o开发者_开发知识库ne for testing purposes and one for a production system. The install is an MSI file created directly in Visual Studio 2005. Is there any way to enable this?
I am up for using other tools to generate the install or even using Ocra.exe directly if I had to, but for now at least InstallShield is out of the question.
As slugster has stated, you need to update the ProductCode in the Property table. You will also need to change the package code in the Summary Stream Information. The easiest way to modify your MSI is by using automation with VBScript.
The Windows Installer SDK contains useful scripts (WiRunSQL.vbs, WiSumInf.vbs) that will allow modify your MSI as follows:
To change the product code
cscript WiRunSQL.vbs your.msi "UPDATE Property SET Value='{AAAAAAAA-BBB1-CCCC-DDDD-EEEEEEEEEEEE}' WHERE Property='ProductCode'"
To change the package code:
cscript WiSumInf.vbs your.msi 9={AAAAAAAA-BBB2-CCCC-DDDD-EEEEEEEEEEEE}
Just note the new codes should be a valid unique GUID.
You need to author a transform (.mst), which is applied to the MSI file before it runs. This transform can do various things, including changing the product code. It is this changing of the product code which allows more than one instance of the same product to be installed, because to the Windows installer it looks to be a different product.
This transform functionality is native to the Windows installer engine. In other words, you can author these files yourself, products like InstallShield just make it easier. Other MSI creation products will likely have the same functionality so you could shop around, and there is likely to be a tool in the Windows Installer SDK to do it (I haven't actually looked, I just use InstallShield).
You can use Windows Installer Guide, Database Transforms to get you started.
Refer to the Microsoft documentation on Installing Multiple Instances of Products and Patches.
From memory there was discussion on the WiX list last month with someone trying to do this when using WiX to install multiple websites on the same server. If you can find the relevant threads there should be some more through responses than mine there :)
精彩评论