I am running a WiX bundle installation. One of the MSI packages should close the application if running:
<util:CloseApplication Id="CloseApplication" Target="My App.exe">1</util:CloseApplication>
This is in the <Product>
element before the <Feature>
element. I added the 1
to make sure the condition was true.
The MSI log has this to say:
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.
If I set prompts to 'no' like this:
<util:CloseApplication Id="CloseApplication" Description="Closing running application" Target="My App.exe" RebootPrompt="no" ElevatedCloseMessage="no" CloseMessage="no">1</util:CloseApplication>
The log says this:
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.
Either way the installation completes but the original app is still running and doesn't get shut down.
The application in question is a WPF app, I have <MajorUpgrade Schedule="afterInstallExecute" ...
and the installer is run using a managed boostrapper modified from WiXBA.
I also couldn't get CloseApplication to work and i didn't put too much effort on it but i'm using a different approach to close an app using taskkill and QtExec like this:
Note this is
immediate
CA, to run itdeffered
please take a look at wix documentation: http://wixtoolset.org/documentation/manual/v3/customactions/qtexec.html