Vinay
Vinay

Reputation: 285

Wix InstanceTransform with AllowDowgrades

I have a wix setup project with wxs file,

I have configured MajorUpgrade AllowDowngrades="yes" and have defined instance transform to allow multiple instance.

<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>

 <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>

Now when i try to install multiple instance of the MSI, the previous instance gets Uninstalled even though the ProductName,ProductCode and InstanceId is different.

Upvotes: 2

Views: 146

Answers (1)

PhilDW
PhilDW

Reputation: 20790

A major upgrade occurs because the UpgradeCode is the same in older and newer products, and in fact it requires the ProductCode to be different. If you need to have a specific upgrade for each different instance (and ProductCode) then add a new unique UpgradeCode to your Instance elements.

Upvotes: 2

Related Questions