我已经在互联网上阅读了很多例子,但我无法弄清楚出了什么问题.我有一个WiX安装程序,可以在安装时将所有MySQL服务器文件复制到某个位置.然后我想在安装结束之前运行MySQLInstanceConfig.exe.
<CustomAction Id="CAConfigureMySqlInstance"
Directory="dir96BE76D0898DC48E62BC8465D43A5949"
Impersonate="no"
Execute="commit"
ExeCommand="[dir96BE76D0898DC48E62BC8465D43A5949]MySQLInstanceConfig.exe"
Return="check"
/>
<InstallExecuteSequence>
<Custom Action='CAConfigureMySqlInstance' After='InstallFiles' />
<!-- See this for Before/After sequence moments: http://msdn.microsoft.com/en-us/library/windows/desktop/aa371199(v=vs.85).aspx -->
</InstallExecuteSequence>
Run Code Online (Sandbox Code Playgroud)
我认为After='InstallFiles'
确实是安装程序将所有文件放在正确的位置之后.现在我看到进度条在安装程序中的"复制新文件"中.然后我收到一条消息"无法运行此安装所需的程序".当我查看日志文件时,我看到了这个:
MSI(s)(54:94)[14:14:32:886]:注意:1:1721 2:CAConfigureMySqlInstance 3:C:\ Program Files(x86)\ MyCompnay\MySQL\MySQL Server 5.5\bin\4: C:\ Program Files(x86)\ MyCompany\MySQL\MySQL Server 5.5\bin\MySQLInstanceConfig.exe
每当我在'Run(Windows + R)'中复制该路径时,都会运行MySQL配置器!所以路径是正确的.因此我得出结论,在错误发生的那一刻,文件已经被复制到该位置!错误代码是1721.
每当我更改ExeCommand
为C:\Windows\Explorer.EXE C:\SomeDirIKnow
,Windows资源管理器都会启动...所以自定义操作似乎是正确的...
我该如何解决这个问题?
我把它作为
<CustomAction Id="CAConfigureMySqlInstance"
Directory="dir96BE76D0898DC48E62BC8465D43A5949"
Impersonate="no"
Execute="deferred"
ExeCommand='"[dir96BE76D0898DC48E62BC8465D43A5949]MySQLInstanceConfig.exe"'
Return="check"
/>
<InstallExecuteSequence>
<Custom Action='CAConfigureMySqlInstance' Before='InstallFinalize' />
<!-- See this for Before/After sequence moments: http://msdn.microsoft.com/en-us/library/windows/desktop/aa371199(v=vs.85).aspx -->
</InstallExecuteSequence>
Run Code Online (Sandbox Code Playgroud)
注意使用的引号ExeCommand='"
=>即单,双,exe的位置,double,single.
荒谬!花了1个多小时!