安装程序后,它会在安装完成后立即触发(由安装程序)。但是当我从控制面板卸载该程序时,它也尝试打开 exe,这会出现以下错误:
Windows cannot find 'MyExe.com'. Make sure you typed the name correctly, and then try again. To search for a file, click the Start button, and then click Search.
在后台运行 cmd.exe。 按“确定”后,会弹出另一个窗口,显示:
There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support...
虽然程序被卸载,但这些错误是不可取的。
此外,当我安装较新版本且旧版本的程序已存在时,我会收到类似的消息,因为安装程序会首先尝试卸载旧版本。
这是代码:
....
<Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
<Upgrade Id="D2B0D435-0F86-4D5E-A988-B24215882***">
<UpgradeVersion
Minimum="1.0.0.0" Maximum="99.0.0.0"
Property="PREVIOUSVERSIONSINSTALLED"
IncludeMinimum="yes" IncludeMaximum="no" />
</Upgrade>
<CustomAction Id="LaunchApp" Directory="INSTALLDIR" ExeCommand="[SystemFolder]cmd.exe /C start MyExe.exe" />
<InstallExecuteSequence>
<RemoveExistingProducts Before="InstallInitialize" />
<Custom Action="LaunchApp" After="InstallFinalize" />
</InstallExecuteSequence>
</Product>
</Wix>
我想要的是,安装程序仅在安装时尝试运行该程序,而在卸载时不执行任何操作。
提前致谢!
最佳答案
您的问题是您的操作没有条件,因此每次都会触发。至少您需要“未安装”条件。然而,对于更优雅的解决方案,请阅读:
关于wix - 卸载问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5354252/