Tell the user to close the application during uninstallation (on WiX)

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

Everything works fine, but it’s very difficult for me to deal with the following use case: the installed software still works when the user tries to delete > this. The default behavior seems to delete all files, but allows you to run the application (which is difficult to see in my case, because it is in the task tray).

I added the following code to 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 will not work - worse, it shows a dialog box asking for a reboot during installation !

What would be the right way to do this?

+6
wix uninstall
source share
6 answers

As far as I remember, it should be enough to add the following links to your interface:

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

CloseApplication is intended only for closing applications during installation, but it is buggy (at least when I tried a few months ago, maybe it was fixed now?)

Unfortunately, this is again an example of very poor WiX documentation, even standard installation and removal scripts like this one are not documented.

+7
source share

A similar question was asked a few days ago on the wix-users mailing list. The answer was this:

This is how Windows pre-Vista and Restart Manager work. There should be a top-level window available. The application in the tray is not count.

The wix-users archive section also has several topics.

+1
source share

You can check the deletion logs ( here's how to enable them ), as far as I remember, the Windows installer will put your files in a waiting state and wait for a reboot at the end.
You can also write a simple custom action that will kill your process.

0
source share

for an example of how to use closeapplication, follow this link: github wix project, unit tests

To display the prompt dialog, you can use: <util:CloseApplication Id="CloseIE" Target="iexplore.exe" PromptToContinue="yes" Description="Test" />

0
source share

Shay's answer is correct. Recent versions of Windows Installer behave like this. The Windows installer faces many problems to make sure that you can avoid a reboot during uninstall by re-matching the used DLL files, etc. Typically, a running application can continue to work after uninstallation, and some cleaning will occur when the application is turned off, the rest after the next reboot. The fact is that if the Windows installer can move the executable files to another place, start all the applications and replace the ones that were in use (but the memory backup has been redone), and all that is required removes a little unnecessary garbage on the next reboot, why force restart the computer? There is no need to display the Files In Use dialog box, so the situation does not occur.

This can cause problems if the application tries to access the file being deleted, but I assume the risk is considered low. If the application should know that the uninstallation is ongoing, then work with Restart Manager should work - Windows will inform you that the uninstallation is in progress. Otherwise, Shay is correct. Write, if necessary, deleting user actions to inform the application to close.

0
source share

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

 <Custom Before="InstallValidate" Action="WixCloseApplications"/> 
0
source share

All Articles