我有一个 Wix Managed Bootstrapper Application / bundle (burn) 安装程序。
在 C# 中,我需要使用捆绑包的 ProductCode 或 UpgradeCode 来确定该捆绑包的安装状态。我尝试使用 Wix 部署工具基础 (DTF) 库的Microsoft.Deployment.WindowsInstaller.ProductInstallation
类,但它似乎不适用于捆绑包,仅适用于嵌入式包 (MSI):
var myBundle = new ProductInstallation(bundleProductCode);
if (myBundle.IsInstalled) ... // This returns false, even if the bundle is installed
我最终还需要尝试从相同的代码中卸载捆绑包。我计划使用 DTF 的Installer.ConfigureProduct
静态方法,但它似乎也不适用于捆绑包,仅适用于产品,因为以下调用会引发ArgumentException
消息“此操作仅对当前安装的产品有效”。即使安装了捆绑软件:
Microsoft.Deployment.WindowsInstaller.Installer.ConfigureProduct(
bundleProductCode, 0, InstallState.Absent, "");
所以,我的问题是:
如何确定我的捆绑包的当前安装状态以及如何强制卸载,全部来自 C#(最好使用 DTF API)?