安装程序无法关闭运行目标...变通办法?

时间:2014-04-01 20:13:26

标签: wix windows-installer

我有一个WIX安装程序。

当我在运行旧版本软件的计算机上测试我的安装程序时,我会收到以下提示。

问题是安装程序无法关闭应用程序。当新程序运行时,它会抱怨旧程序正在运行。

有没有办法强行杀死应用程序? 如果没有,WIX中是否有一些条目要求用户在继续安装之前关闭应用程序?

enter image description here

2 个答案:

答案 0 :(得分:2)

我在这里找到了答案:

WiX <util:CloseApplication> element not working

我在上面的帖子中对解决方案进行了一次调整。我在安装顺序中先前删除了应用程序,因此上面的窗口不会出现。

<!-- Code to force termination of running program...MSIExec couldn't do it -->
<Property Id="QtExecCmdLine" Value='"[WindowsFolder]\System32\taskkill.exe" /F /IM "$(var.ProductName).exe"'/>
<CustomAction Id="APP.TaskClose" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="ignore"/>
<InstallExecuteSequence>
    <Custom Action="APP.TaskClose" After="LaunchConditions"/>
</InstallExecuteSequence>

如果你想知道“$(var.ProductName).exe”是什么,我在命令行上传递exe名称,因为我正在创建同一程序的几个品牌版本。只需替换你的exe名称。

是的,这种特殊的做法是安全的。内存中没有可能丢失的数据。

答案 1 :(得分:1)

您应该使用WiX util扩展名CloseApplication:

http://wixtoolset.org/documentation/manual/v3/xsd/util/closeapplication.html

那应该有用。

长期以来,您应该将应用程序与Restart Manager集成,以便它自动关闭。

相关问题