Combining multiple WiX installers and retaining upgrade behaviour

Sometimes there is a need to combine multiple WiX installers into one. However one problem arises: the new – “combined” installer should upgrade ( remove ) old installers. In order to achieve that you have to use upgrade section in your WiX script.

First of all you have to create upgrade section for current installation then upgrade section for each product you have to upgrade. In the following example take a look on UpgradeCode in the first upgrade section and Id attribute in Product. The second upgrade section upgrades (removes) other product.

<Product Id=e4824422-4901-4b15-954a-18a46aa74e8d Name=WixProject2 Language=1033 Version=1.0.0.0 Manufacturer=PUT-COMPANY-NAME-HERE UpgradeCode=448fe241-3ef5-4f0b-8160-96f5d42ecb04>

  <Package InstallerVersion=200 Compressed=yes />

 

  <Upgrade Id=448fe241-3ef5-4f0b-8160-96f5d42ecb04>

    <UpgradeVersion Minimum=1.0.0 OnlyDetect=yes Property=NEWERVERSIONDETECTED/>

    <UpgradeVersion Minimum=1.0.0 IncludeMinimum=yes Maximum=1.0.0 IncludeMaximum=yes Property=OLDERVERSIONBEINGUPGRADED/>

  </Upgrade>

 

  <Upgrade Id=a882e462-67d8-4aed-89c2-fa75a912eed0>

    <UpgradeVersion Minimum=1.0.0 OnlyDetect=yes Property=NEWERVERSIONDETECTED1/>

    <UpgradeVersion Minimum=1.0.0 IncludeMinimum=yes Maximum=1.0.0 IncludeMaximum=yes Property=OLDERVERSIONBEINGUPGRADED1/>

  </Upgrade>

More info on upgrade can be found here