Wix's util:CloseApplication extension doesn't seem to work
Asked Answered
G

3

8

I'm trying to close a process before uninstallation using Wix. I've confirmed that it works as long as there's a visible window, but if there isn't a visible window (which is the case most of the time with this app since it's a system tray app), the uninstaller just hangs, and eventually continues with the uninstallation, leaving the process running.

According to this forum post, it seems like Wix has had trouble closing minimized apps in the past, so I wonder if this is related?

Any suggestions as to what else I can do to make sure the process gets shut down? Is there any way I can try and capture the message in my app using the Win32 api maybe?

Here's the CloseApplication declaration:

<util:CloseApplication Id="CloseApp" CloseMessage="yes" Target="App.exe" RebootPrompt="yes" />

And here's the custom action:

<Custom Before="InstallInitialize" Action="WixCloseApplications">REMOVE = "ALL"</Custom>
Gorges answered 4/6, 2010 at 20:26 Comment(0)
E
6

It looks like you are scheduling the WixCloseApplications custom action before the installation transaction. The way the custom action works, is it scheduled a deferred action that actually closes the applications. It can't do that work unless it happens during the transaction (After="InstallInitialize").

The fix is probably pretty easy. Remove the Custom/@Action="WixCloseApplications" element.

Elledge answered 14/2, 2011 at 22:51 Comment(0)
W
3

At first, don't forget to reference WixUtilExtension.dll assembly. Also check if Wix element contains definition of UtilExtension namespace:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

I've noticed that you should change your custom action to be executed before InstallInitialize.

<Custom Before="InstallInitialize" Action="WixCloseApplications">REMOVE = "ALL"</Custom>

If you apply those changes and CloseApplications extension doesn't work, try logging installation process using

msiexec /i MyApplication.msi /l*v MyLogFile.txt
Wheelwright answered 25/9, 2015 at 12:28 Comment(0)
D
1

I also faced this problem. Changing the Before attribute to "InstallValidate" worked for me.

<Custom Before="InstallValidate" Action="WixCloseApplications"/>
Debi answered 30/1, 2017 at 14:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.