我有一个由Wix工具集创建的.msi文件,用于安装5个驱动程序。我有一个安装应用程序,可以使用msiexec.exe命令通过CreateProcess启动.msi,并提供一个UI。目前,我的需求是获得安装的详细结果-哪些驱动安装成功,哪些驱动安装失败。既然我只能得到CreateProcess的结果,那么如何从安装中检索详细的结果呢?如果你能提供一些关于这个问题的信息,我将非常感谢。
我使用difx:.msi标志创建了驱动程序文件,如下所示:
<difx:Driver AddRemovePrograms="no" DeleteFiles="no" ForceInstall="no" Legacy="no" PlugAndPlayPrompt="no" />发布于 2016-07-15 01:16:53
基于MSI的设置是事务性的。它要么全部工作,要么全部失败,并将系统回滚到其以前的状态。看起来你已经做出了一个选择,击败了这个范例,并让它部分成功,留下了一些安装的驱动程序和其他的驱动程序。
您似乎还隐藏了安装程序的UI,因此找不到错误信息。
我有两个建议:
https://msdn.microsoft.com/en-us/library/windows/desktop/bb309215(v=vs.85).aspx
这里也有C# p/invoke的等价物。如果您不想显示所有的UI,那么只要收集错误消息并将其显示给用户就可以了。这是获取实际错误消息的唯一可靠方法。这是您拥有UI并仅收集您认为重要的消息的受支持方式。
发布于 2016-07-14 09:29:10
您可以使用/L*V参数检索详细的安装日志:
msiexec /i "C:\MyPackage\Example.msi" /L*V "C:\log\example.log"你可以阅读更多的here。
其总体结构为:
msiexec.exe [/i][/x] <path_to_package> [/L{i|w|e|a|r|u|c|m|o|p|v|x+|!|*}][/log]
/L - enable logging i - include status messages w - include non-fatal warnings e - include all error messages a - mention when an action is started r - include action-specific records u - include user requests c - include the initial UI parameters m - include out-of-memory or fatal exit information o - include out-of-disk-space messages p - include terminal properties v - verbose output x - include extra debugging information + - append to an existing log file ! - flush each line to the log * - log all information, except for v and x options
发布于 2016-07-14 15:08:04
另一种更简单的方法是向机器上的check if the drivers are installed编写一个小的C#自定义操作,而不是解析日志。
您需要将该自定义操作安排为延迟(而不是立即)关闭安装过程的结束。
https://stackoverflow.com/questions/38364091
复制相似问题