Reputation: 285
I have a Wix wxs file where i have configured to have multiple instance using Instance Transform.
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define WixDemoWPFApp_TargetDir=$(var.WixDemoWPFApp.TargetDir)?>
<Product Id="*" Name="WixSetupWPFApp" Language="1033" Version="2.0.0.0" Manufacturer="Licence Owner"
UpgradeCode="ae4af8f5-9287-408a-b7bd-d2fdb89a8da7">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="Downgrade not allowed" />
<MediaTemplate />
<Property Id="INSTANCEID" Value="0" />
<InstanceTransforms Property="INSTANCEID">
<Instance Id="I01" ProductCode="{888F3620-F2AB-4C0B-A276-0A5AE9C0B6CB}" ProductName="WixDemo 3.7.4 Dev" />
<Instance Id="I02" ProductCode="{01D23E62-A369-43E1-914A-FA017B1EE822}" ProductName="WixDemo 3.7.4 Test" />
<Instance Id="I03" ProductCode="{00D804D7-0AD0-412C-805A-4D37FF74FFA3}" ProductName="WixDemo 3.7.5" />
<Instance Id="I04" ProductCode="{6C3E5B4E-BF7D-4E7E-A62A-B7DFB750F581}" ProductName="WixDemo 3.7.6" />
</InstanceTransforms>
<Feature Id="ProductFeature" Title="WixSetupWPFApp" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<SetDirectory Id="WINDOWSVOLUME" Value="[WindowsVolume]" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WINDOWSVOLUME">
<Directory Id="WixDemo" Name="WixDemo">
<Directory Id="INSTALLLOCATION" Name="WixDemo" />
</Directory>
</Directory>
</Directory>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLLOCATION">
<Component Id="WixDemoWPFApp.exe" Guid="42907ee1-2bb2-4416-8d8f-cebc2bf53f09">
<File Id="WixDemoWPFApp.exe" Name="WixDemoWPFApp.exe" Source="$(var.WixDemoWPFApp_TargetDir)WixDemoWPFApp.exe" />
</Component>
<Component Id="WixDemoWPFApp.exe.config" Guid="ed8a9503-2eb1-4f49-b7f3-f027f542c93f">
<File Id="WixDemoWPFApp.exe.config" Name="WixDemoWPFApp.exe.config"
Source="$(var.WixDemoWPFApp_TargetDir)WixDemoWPFApp.exe.config" />
</Component>
<Component Id="WixDemoWPFApp.pdb" Guid="5bf6cd62-7bc7-42cd-839a-7b66d7e8a09a">
<File Id="WixDemoWPFApp.pdb" Name="WixDemoWPFApp.pdb" Source="$(var.WixDemoWPFApp_TargetDir)WixDemoWPFApp.pdb" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
And i install by executing the following command,
msiexec INSTALLLOCATION="D:\Wixtestinstance\1" /i WixSetupWPFApp.msi MSINEWINSTANCE=1 TRANSFORMS=":I01"
Upvotes: 1
Views: 2571
Reputation: 180
Yes - it is possible to change the ARP ProductName by simply setting the ProductName
in your Wix source file.
I'm doing this for multiple instances where I set the ProductName value according to the INSTANCENAME
property that itself gets set as a result of a c# custom action:
<Property Id ="INSTANCEID" Value ="_" Secure ="yes"/>
<Property Id ="INSTANCENAME" Secure ="yes"></Property>
<InstanceTransforms Property ="INSTANCEID">
<Instance Id ="I01" ProductCode ="*" UpgradeCode ="{GUID}" ProductName ="I01"/>
<Instance Id ="I02" ProductCode ="*" UpgradeCode ="{GUID}" ProductName ="IO2"/>
<Instance Id ="I03" ProductCode ="*" UpgradeCode ="{GUID}" ProductName ="IO3"/>
</InstanceTransforms>
<SetProperty Id ="ProductName" Before ="LaunchConditions" Value ="[INSTANCENAME]"></SetProperty>
In the Custom Action:
session["INSTANCENAME"] = "_" + session["INSTANCENAME"];
The ProductName ="I01"
in the InstanceTransforms
will get replaced by the SetProperty
call.
True, this name will not be the one displayed on the uninstall dialog - but maybe that's ok? For me the most important thing was to have a decent instance name in the ARP area.
Upvotes: 1
Reputation: 15905
Instance transforms must be created ahead of time. While technically nothing prevents a bootstrap from generating transforms dynamically at installation time just before invoking the MSI, multiple practical concerns do prevent this.
Of these, only the digital signature problem is likely to be insurmountable. But the potential problems covered by the other concerns are really hard to get right.
Upvotes: 2