2

We have two different products that can't be both installed on the same machine without them breaking, so we need to add a check in the Wix installer for the first one, call that A, that prevents it from being installed on a machine that already has the other, say B, installed.

We already have different UpgradeCodes defined for A and B, but what do I need to add to the Wix install XML to say something like "if you find anything with UpgradeCode A, don't install this, since this has UpgradeCode B".

I've seen similar questions here but the answers don't usually provide clear xml, and are only partially similar, such as checking for x86 vs 64 of the same product or just prevent installation of an older version of the same product, which we already do. Almost all of the Wix answers on here don't actually contain xml, which I find weird, since that's the only way I know of how to define these things.

The Wix documentation on this was also pretty sparse, I found something about AppSearch (http://wixtoolset.org/documentation/manual/v3/xsd/wix/appsearch.html) but that doesn't help me in figuring out how to use that in the xml to prevent the installation if the app is found, or how to search for it by the UpgradeCode or differently somehow.

gakera
  • 3,589
  • 4
  • 30
  • 36
  • Perhaps I can use a variation of this, I'll post an answer if I can work it out. http://wixtoolset.org/documentation/manual/v3/howtos/files_and_registry/check_the_version_number.html – gakera Oct 04 '16 at 11:17
  • This will most likely help also: https://blogs.technet.microsoft.com/alexshev/2008/02/10/from-msi-to-wix-part-3-launch-conditions-and-application-search/ – gakera Oct 04 '16 at 11:27

2 Answers2

3

You should be able to add some upgrade detection in product A:

<Upgrade Id="$(var.ProductBInstallerUpgradeGUID)" >
    <UpgradeVersion
        IncludeMaximum ="yes"
        IncludeMinimum="yes"
        Maximum="255.255.65535.65535"
        Minimum="1.0.0.0"
        MigrateFeatures="no"
        Property="PRODUCTBISINSTALLED"
        OnlyDetect="yes" />      
</Upgrade>

then you can use a launch condition

<Condition Message="!(loc.CannotInstallWithProductBInstalled)">NOT PRODUCTBISINSTALLED OR Installed</Condition>

So if product b is detected on this machine, it will stop the install with the error message that is defined by the "CannotInstallWithProductBInstalled" string in the localization file.

Similarly for Product A detection in product B

Brian Sutherland
  • 4,698
  • 14
  • 16
2

You can search for a component id from the other installed product with a Property declaration that includes a componentsearch, like the examples here with Property id and ComponentSearch:

How to check for installed package in WiX 3.0?

Then use the property in a launch condition.

UpgradeCode detection works most of the time, but won't work cross-context. If the previous product was installed per machine (or per user) and yours is the opposite then it won't be detected by an upgrade search. Assuming that all the installs are the same and specified in InstallScope, then an UpgradeSearch will be fine.

Community
  • 1
  • 1
PhilDW
  • 20,260
  • 1
  • 18
  • 28