【发布时间】:2018-09-12 02:45:22
【问题描述】:
我无法使用 ConfigureProduct 安静地运行卸载。我有以下内容:
using Microsoft.Deployment.WindowsInstaller;
Installer.ConfigureProduct(productCode, 0, InstallState.Absent, "/q");
根据之前的一些帖子,“/q”应该可以工作,但每次运行代码时都会出现以下异常。
"Invalid command line argument. Consult the Windows Installer SDK for detailed command line help."
请注意,“/q”在使用 msiexec.exe 时确实有效,但我想使用 Microsoft.Deployment.WindowsInstaller 来执行此操作。
我还尝试通过以下方式将 UI 设置为静音:
Installer.SetInternalUI(InstallUIOptions.Silent);
Installer.ConfigureProduct(productCode, 0, InstallState.Absent, "");
然后我得到以下异常:
"Fatal error during installation."
从消息中我收集到 SetInternalUI 用于安装而不是卸载但不确定。
我正在使用来自 WiX 3.9 R2 安装的 DLL,即版本 2.0.50727。
感谢任何帮助。谢谢!
编辑:我仔细查看了“ConfigureProduct”方法中“commandLine”参数的 cmets。
// commandLine:
// Specifies the command line property settings. This should be a list of the
// format Property=Setting Property=Setting.
所以基本上不,你不能传递“/q”、“/l”或其他任何不是“Property=Setting”形式的东西。答案中链接的参考帖子中的示例似乎是错误的。 (或者版本之间发生了一些变化,但我对此表示怀疑。)
【问题讨论】:
标签: c# wix windows-installer