Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prompt user to close application during uninstall (in WiX)

I am using Windows Installer XML 3.0 (WIX3) to install some software.

Everything works fine, however, I'm having a really hard time to handle the following use case: the installed software is still running, when the user tries to uninstall it. The default behavior seems to remove all files but lets the application running (which is hard to see in my case, because it's sitting in the task tray).

I added the following code in my installer.wxs file:

<InstallExecuteSequence>
  <Custom Action="WixCloseApplications" Before="RemoveFiles" />
</InstallExecuteSequence>

<util:CloseApplication Id="CloseFoobar"
                       CloseMessage="no"
                       Description="FooBar is still running!"
                       ElevatedCloseMessage="no"
                       RebootPrompt="no"
                       Target="foobar.exe" />

But this doesn't work - even worse, it shows a dialog that asks for a reboot during install!

What would be the correct way to do it?

like image 313
beef2k Avatar asked Apr 02 '09 17:04

beef2k


2 Answers

As far as I remember it should be enough to add the following references to your UI:

<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />

The CloseApplication stuff is only for closing applications during install, but it is buggy (at least when I tried it some months ago, maybe it's fixed now?)

Unfortunately, this is again an example for the very poor documentation of WiX, not even standard install/uninstall scenarios like this one are documented.

like image 133
Dirk Vollmar Avatar answered Nov 20 '22 09:11

Dirk Vollmar


There was a similar question asked on the wix-users mailing list a couple of days ago. The answer given there was:

This is the way that Windows works pre-Vista and Restart Manager. There has to be a top-level window available. An app in the tray doesn't count.

There are a few threads on the topic in the wix-users archive as well.

like image 45
saschabeaumont Avatar answered Nov 20 '22 11:11

saschabeaumont