0

I have a WIX Bootstrapper Burn bundle which contains 4 MsiPackages and has been released in production. Our latest version of the bundle is to no longer ship one of the packages and should uninstall the package should it exist. What is the best way to uninstall the MsiPackage without providing the entire msi in the bundle?

I have tried:

  1. Removing the PackageGroup from the chain entirely - This leaves the product behind.
  2. Adding the MsiPackage and setting the installlevel to 0 - This needs a very large payload as the msi that is being removed is large.

I also tried using product search to find the state

<util:ProductSearch Id="AppX" UpgradeCode="XXXXXX-XXXX-XXXX-XXXX-XXXXXXXX" Result="state" Variable="APPXSTATE" />

but tried to hook it up to an ExePackage to run msiexec /x UpgradeCode but I figure is the wrong way to uninstall.

Whats the best way for me to purge msi with UpgradeCode X if it exists in this newer burn installer?

Thanks

Seravy
  • 245
  • 4
  • 9

1 Answers1

2

Note: I am not aware of any auto-magic constructs to use in collaboration with util:ProductSearch to uninstall existing MSI installations.

Upgrade Table: I assume the four different products have different upgrade codes "per family"? If so - and if you are positive it will never need to be installed again - then I suppose you could specify that it should be uninstalled via a major upgrade for one or more of the packages you will keep delivering. Note: It might be possible to uninstall even if all setups share the same upgrade code, but that requires a lot more care and testing.

This solution involves adding the upgrade code for the MSI you want to remove to the upgrade table of those MSI setups you want to preserve with a version range specified that will uninstall all "known prior editions". Technical details for how to do this can be found here: Adding entries to MSI UpgradeTable to remove related products. As stated it is enough to do so for one of the products that will remain, but you can do it for all of them to be sure. No errors should result if the product has already been uninstalled. I might want to set a tighter range than what is shown in that technical sample for the versions targeted.

ExePackage: It should be possible to uninstall as you have suggested by using an ExePackage instead. It could run msiexec.exe directly I suppose, or maybe launch a VBScript, Powershell script or even a batch file or your own EXE file compiled from C++ or C# (the latter with unfortunate runtime requirements). I have never tried this approach.

Please note that you do not uninstall by upgrade code in the fashion you do with msiexec.exe /x UpgradeCode - at least I have never been able to make that work (not tested for a while). Instead you need to uninstall via product code (How can I find the product GUID of an installed MSI setup?), OR you can use VBScript and MSI API automation to uninstall by using the Installer.RelatedProducts function and then kicking off uninstall that way as shown here: Powershell: Uninstall application by UpgradeCode. This is similar to what happens when Windows Installer processes the Upgrade Table. All releated products - those sharing the same upgrade code - are enumerated and you can handle them as you do so.


Some Links:

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • Thanks for your suggestions, I will read through them and see how they work in my solution. Yes all 4 products have different upgrade codes, the 3 in the bundle will be receiving new versions. I had thought about shipping a stripped MSI with just the upgrade code and newer version and having that uninstall. Will reply back when i have more results. – Seravy Aug 17 '18 at 03:51
  • In general you can uninstall MSI files with any upgrade code from any other MSI setup. It is all a matter of authoring the Upgrade Table properly to target the correct versions you want to uninstall. – Stein Åsmul Aug 17 '18 at 04:18