我无法使用ConfigureProduct进行卸载,无声地运行。我有以下几点:使用Microsoft.Deployment.WindowsInstaller.Installer.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是安装,而不是的卸载但不确定。
我正在使用版本为2.0.50727的WiX 3.9 R2安装中的DLL。
任何帮助表示赞赏。谢谢!
编辑:我在“ConfigureProduct”方法中对“commandLine”参数的注释看起来更接近一些。
// commandLine:
// Specifies the command line property settings. This should be a list of the
// format Property=Setting Property=Setting.
所以基本上没有,你不能传递“/ Q”,“/ L”,或其他任何不在表“属性=设置”。答案中链接的参考文章中的例子似乎是错误的。 (或其它版本之间的改变,但我对此表示怀疑。)
是的,这就是我得到致命错误的原因。我从一个提升的命令提示符启动了程序,它工作。有没有简单的方法使用Microsoft.Deployment.WindowsInstaller API以提升模式运行ConfigureProduct? – user2958211