I use instance transformations to install the same product several times on the same computer. When I run the .msi installation file, I pass TRANSFORMS = ": X" (and several other variables necessary for installation) to the command line, where X is the version of the Program used.
In the Product.wxs file, I then assign a new ProductCode using the InstanceTransforms tag, for example:
<Property Id="INSTANCEID" Value="Default"/>
<InstanceTransforms Property="INSTANCEID">
<Instance Id="I1" ProductCode="$(guid.NewGuid())"/>
<Instance Id="I2" ProductCode="$(guid.NewGuid())"/>
<Instance Id="I4" ProductCode="$(guid.NewGuid())"/>
<Instance Id="I3" ProductCode="$(guid.NewGuid())"/>
<Instance Id="I5" ProductCode="$(guid.NewGuid())"/>
<Instance Id="I6" ProductCode="$(guid.NewGuid())"/>
<Instance Id="I7" ProductCode="$(guid.NewGuid())"/>
<Instance Id="I8" ProductCode="$(guid.NewGuid())"/>
<Instance Id="I9" ProductCode="$(guid.NewGuid())"/>
</InstanceTransforms>
In addition, the UpgradeCode is added to the UpgradeTable in a custom action, the corresponding code:
Database db = session.Database;
session.Log("Get DB: {0}", db.FilePath ?? string.Empty);
string sqlInsertSring = db.Tables["Upgrade"].SqlInsertString + " TEMPORARY";
session.Log("DB Tables, querying with SQL: {0}", sqlInsertSring);
View view = db.OpenView(sqlInsertSring);
session.Log("OpenView, adding two new records to the UpgradeView.");
session.Log("Inserting line: {0}, null, {1}, null, 512, null, \"UPDATE\"",
session["UpgradeCode"], session["ProductVersion"]);
view.Execute(new Record(new object[] { session["UpgradeCode"], null,
session["ProductVersion"], null, 512, null, "UPDATE"}));
session.Log("Inserting line: {0}, {1}, null, null, null, 0, \"NEWERVERSIONINSTALLED\"",
session["UpgradeCode"], session["ProductVersion"]);
view.Execute(new Record(new object[] { session["UpgradeCode"],
session["ProductVersion"], null, null, 0, null, "NEWERVERSIONINSTALLED" }));
view.Close();
, , , . . , , .
: (I1 I2). I2 . , I1, I2 ( ).
MSI , I1 ( ), I2 ( , ):
- MSI (s) (B0:F8) [09:06:48:745]: Running product '{C33371A0-C32A-4120-BD8F-ACDC79E13458}' with elevated privileges: Product is assigned.
- MSI (s) (B0:F8) [09:06:48:776]: PROPERTY CHANGE: Modifying TRANSFORMS property. Its current value is ':I2'. Its new value: ':I1'.
- MSI (s) (B0:F8) [09:06:48:823]: PROPERTY CHANGE: Adding DATADIR property. Its value is
MSI (s) (B0:F8) [09:06:49:463]: PROPERTY CHANGE: Adding CURRENTDIRECTORY property. Its value is 'C:\Users\Administrator\Desktop'.
- [Further arguments passed]
- MSI (s) (B0:F8) [09:06:49:494]: PROPERTY CHANGE: Adding CLIENTUILEVEL property. Its value is '2'.
- MSI (s) (B0:F8) [09:06:49:572]: PROPERTY CHANGE: Adding CLIENTPROCESSID property. Its value is '6424'.
- MSI (s) (B0:F8) [09:06:49:587]: Machine policy value 'DisableAutomaticApplicationShutdown' is 0
- MSI (s) (B0:F8) [09:06:49:634]: RESTART MANAGER: Disabled by MSIRESTARTMANAGERCONTROL property; Windows Installer will use the built-in FilesInUse functionality.
- MSI (s) (B0:F8) [09:06:49:681]: PROPERTY CHANGE: Adding MsiSystemRebootPending property. Its value is '1'.
- MSI (s) (B0:F8) [09:06:49:728]: PROPERTY CHANGE: Modifying TRANSFORMS property. Its current value is ':I1'. Its new value: ':I2'.
- MSI (s) (B0:F8) [09:06:49:821]: TRANSFORMS property is now: :I2
: TRANSFORMS I2, , I2 I1.
? , , .
( , ).
EDIT: BTW WiX 3.7.
EDIT 2: .msi :
MSINEWINSTANCE=1 TRANSFORMS=":I[N]" [Further parameters] (where N is the Instance)
.msi MSINEWINSTANCE, TRANSFORMS
, / , , .