How to determine/change install state of a Wix Bundle programatically?

788 views Asked by At

I have a Wix Managed Bootstrapper Application / bundle (burn) installer.

From C#, I need to determine the install state of that bundle using either the ProductCode or UpgradeCode of the bundle. I attempted to use the Wix Deployment Tools Foundation (DTF) library's Microsoft.Deployment.WindowsInstaller.ProductInstallation class, but it does not appear to work for bundles, just the embedded packages (MSIs):

var myBundle = new ProductInstallation(bundleProductCode);
if (myBundle.IsInstalled) ... // This returns false, even if the bundle is installed

I eventually also need to attempt to uninstall the bundle from the same code. I planned to use the DTF's Installer.ConfigureProduct static method, but it also appears to not work with bundles, only products, as the following call throws an ArgumentException with the message "This action is only valid for products that are currently installed." even though the bundle is installed:

Microsoft.Deployment.WindowsInstaller.Installer.ConfigureProduct(
      bundleProductCode, 0, InstallState.Absent, "");

So, my question is:

How can I determine the current install state for my bundle and how can I force an uninstall, all from C# (preferably using the DTF API)?

1

There are 1 answers

3
Bob Arnson On BEST ANSWER

Bundles are a layer above MSI, so MSI has no knowledge of them and can't operate on them. WiX v3.9 has functions in the C/C++ DUtil library to get bundle information, including the path to the cached bundle to uninstall or repair it. So far, nobody's done the work to translate that to C#.