0
votes

I have a wix installer which is used to install different versions of the software. Parallel installations of the same software (diff versions) is allowed. The wix product code is '*' so it is always a major upgrade.

Now, I need to selectively uninstall previous versions of the software. For this I have defined the range of versions in the UpgradeVersion tag?

<Upgrade Id="ID">
  <UpgradeVersion  Minimum="0.0.0.0" Maximum="0.5.0.0" IncludeMinimum="yes" IncludeMaximum="no" Property="FORCEREMOVEOLDVERSION" />
  <UpgradeVersion  Minimum="0.6.0.0" Maximum="0.7.0.0" IncludeMinimum="yes" IncludeMaximum="yes" Property="SELECTIVELY_UNINSTALL" />
  <UpgradeVersion  Minimum="0.8.0.0" Maximum="1.5" IncludeMinimum="yes" IncludeMaximum="yes" Property="OLDERVERSIONDETECTED" />
</Upgrade>

This works perfectly. But, when I have to selectively uninstall the range 0.6 - 0.7 how do I have a separate action to do this as there is only one RemoveExistingProducts tag.

<InstallExecuteSequence>
    <RemoveExistingProducts Overridable="no"  Before="InstallInitialize" /> 
</InstallExecuteSequence>

Can you please suggest possible way to be able to check the 'SELECTIVELY_UNINSTALL' flag and remove the range (0.6-0.7) on this, while automatically removing other previous versions?

Thanks.

1
I think the issue is that those installed products all have the same UpgradeCode, and I believe that Windows Installer will choose one of the installed products to uninstall, not all of them. If the products are installed in parallel and need to be selectively upgraded then they all need different UpgradeCodes. Then you can use Upgrade elements on any upgrade install to decide which of the older products you want to replace. - PhilDW

1 Answers

1
votes

I've never taken the opportunity to verify this myself, but there's supposed to be a very straightforward way to handle this. To understand it, first you have to understand what FindRelatedProducts and RemoveExistingProducts do. The keys are in the second setence of FindRelatedProducts, and the first sentence on RemoveExistingProducts:

When FindRelatedProducts detects a correspondence between the upgrade information and an installed product, it appends the product code to the property specified in the ActionProperty column of the UpgradeTable.

The RemoveExistingProducts action goes through the product codes listed in the ActionProperty column of the Upgrade table and removes the products in sequence by invoking concurrent installations.

Given that you want to always remove any previous versions found and stored in FORCEREMOVEOLDVERSION and OLDERVERSIONDETECTED, but conditionally remove any versions foun and stored in SELECTIVELY_UNINSTALL, all you have to do is conditionally clear the property SELECTIVELY_UNINSTALL. In more complicated scenarios you could even parse the list of product codes stored in an property referenced by an ActionProperty and remove just some of them.

Note that this does not allow you to work around the requirement that ALLUSERS must match by adding product codes to an action property.