简体   繁体   中英

WiX - Allowing a *manual* uninstall of one msi to uninstall another msi that shares the same UpgradeCode (and not just during the MajorUpgrade)

I have a bootstrapper (C# windows forms applications) that trigger two different msi files consecutively out of its resource. The instance transforms between the msi are 'paired' such that one instance transform from the first msi shares an UpgradeCode with one instance tranform from the second msi; these are the pairs that are installed together via the bootstrapper.

The 'core' msi (the first msi that runs) includes the MajorUpgrade element such that when a higher-versioned 'core' msi is run, all related products with a lower version are first uninstalled - this includes the secondary program installed via the second msi since it uses the same UpgradeCode and is recognized as a related product. This is the behaviour I want so that's good, but if I uninstall the 'core' msi program manually via the control panel, it only installs that one. I'd like to get it to uninstall the secondary program as well, even if I manually uninstall the 'core' one.

Do I need to write a custom function that manually calls the uninstall of the secondary msi's program with the ProductCode? Eg, as per here:

Wix - uninstall different product

Or, can I explicitly schedule RemoveExistingProducts to be run for uninstalls? Something like:

<InstallExecuteSequence>
  <RemoveExistingProducts After="InstallFinalize">REMOVE</RemoveExistingProducts>
</InstallExecuteSequence>

Is that not possible because after InstallFinalize of the 'core' msi, it knows nothing about the secondary msi? Basically, I'm wondering if I can also use the RemoveExistingProducts standard action for the manual uninstall the case, like it's doing for the MajorUpgrade case.

Thanks so much in advance.

Unfortunately, the answer is no. RemoveExistingProducts does not trigger during a maintenance operation. You will certain lines in the log file which indicate that:

Skipping RemoveExistingProducts action: current configuration is maintenance mode or an uninstall

What you are trying to do is usually achieved by making use of a bootstrapper application. Have you explored the bootstrapping feature of Wix called Burn? Burn should be able to easily handle your requirement.

If using Burn is not an option for you, then i dont see any other option other than writing your own custom code to achieve this.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM