gpt4 book ai didi

WiX <实用程序 :CloseApplication> element not working

转载 作者:行者123 更新时间:2023-12-05 08:58:52 35 4
gpt4 key购买 nike

我正在运行 WiX 捆绑安装。如果运行,其中一个 MSI 包应该关闭应用程序:

<util:CloseApplication Id="CloseApplication" Target="My App.exe">1</util:CloseApplication>

这是在<Product> <Feature> 之前的元素元素。我添加了 1以确保条件为真。

MSI 日志是这样说的:

MSI (s) (14:94) [21:30:13:979]: Doing action: WixCloseApplications
Action ended 21:30:13: CreateFolders. Return value 1.
MSI (s) (14:68) [21:30:13:993]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI5D24.tmp, Entrypoint: WixCloseApplications
MSI (s) (14!CC) [21:30:14:023]: PROPERTY CHANGE: Adding WixCloseApplicationsDeferred property. Its value is 'My App.exe2'.
Action start 21:30:13: WixCloseApplications.
MSI (s) (14!CC) [21:30:14:023]: Doing action: WixCloseApplicationsDeferred
Action start 21:30:14: WixCloseApplicationsDeferred.
Action ended 21:30:14: WixCloseApplicationsDeferred. Return value 1.
MSI (s) (14:94) [21:30:14:052]: Doing action: InstallFiles
Action ended 21:30:14: WixCloseApplications. Return value 1.
Action start 21:30:14: InstallFiles.

如果我像这样将提示设置为“否”:

<util:CloseApplication Id="CloseApplication" Description="Closing running application" Target="My App.exe" RebootPrompt="no" ElevatedCloseMessage="no" CloseMessage="no">1</util:CloseApplication>

日志是这样说的:

MSI (s) (50:04) [21:43:40:214]: Doing action: WixCloseApplications
Action ended 21:43:40: CreateFolders. Return value 1.
MSI (s) (50:14) [21:43:40:238]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIFFA9.tmp, Entrypoint: WixCloseApplications
Action start 21:43:40: WixCloseApplications.
MSI (s) (50:04) [21:43:40:333]: Doing action: InstallFiles
Action ended 21:43:40: WixCloseApplications. Return value 1.
Action start 21:43:40: InstallFiles.

无论哪种方式安装完成但原始应用程序仍在运行并且不会关闭。

有问题的应用程序是一个 WPF 应用程序,我有 <MajorUpgrade Schedule="afterInstallExecute" ...安装程序使用从 WiXBA 修改的托管 boostrapper 运行。

最佳答案

我也无法让 CloseApplication 工作,我也没有在这上面投入太多精力,但我正在使用一种不同的方法来使用 taskkill 和 QtExec 关闭应用程序,如下所示:

<Property Id="QtExecCmdLine" Value='"[WindowsFolder]\System32\taskkill.exe" /F /IM APP.EXE'/>
<CustomAction Id="APP.TaskClose" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="ignore"/>

<InstallExecuteSequence>
<Custom Action="APP.TaskClose" After="InstallInitialize"/>
</InstallExecuteSequence>

请注意这是立即 CA,要延迟运行它请查看wix文档:http://wixtoolset.org/documentation/manual/v3/customactions/qtexec.html

关于WiX <实用程序 :CloseApplication> element not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20016537/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com