【发布时间】:2014-01-14 12:13:41
【问题描述】:
我有一个 Wix 托管引导程序应用程序/捆绑(刻录)安装程序。
在 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)?
【问题讨论】: