Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid "The following applications should be closed" message during uninstallation with WIX?

I try to write an MSI installer using WIX. During uninstallation I need to run a specialized custom action that first stops my services and then closes the application. I do that after InstallInitialize event using the following mark-up:

<CustomAction Id='myCustomAction' BinaryKey='myDll' DllEntry='msiUninstallInitialize' Execute='deferred' Impersonate='no' />

<InstallExecuteSequence>
    <Custom Action='myCustomAction' After='InstallInitialize'></Custom>
</InstallExecuteSequence>

The issue is that if a previous version of my application was running before I try to upgrade to a newer one using my MSI, I was getting a Restart Manager popping up this message:

enter image description here

and then this one:

enter image description here

To stop it from doing it, I added the following property:

<Property Id="MSIRESTARTMANAGERCONTROL" Value="Disable" />

But now the uninstaller shows this window:

enter image description here

So I was curious, is there any way to disable checks if my app is running (I will close it myself during my custom action processing)?

like image 573
c00000fd Avatar asked Jul 24 '13 00:07

c00000fd


2 Answers

You've disabled the Restart Manager interaction with the Windows Installer so now the Windows Installer is falling back to its old behavior, FileInUse dialog. This behavior is documented with MSIRESTARTMANAGERCONTROL Property.

I've never tried but theory has it that you can make your FilesInUse dialog hidden (Dialog/@Hidden='yes') to cause the dialog to not be shown.

like image 183
Rob Mensching Avatar answered Sep 28 '22 00:09

Rob Mensching


The solution to this is to move your Custom Action that stops your services & processes before the Preparing step in your Install Execution Stage.

Per AdvancedInstaller's docs (emphasis mine):

Preparing - Verifies all volumes for sufficient space for the installation. Checks and notifies the user if any installation files are in use. You can set the deferred, rollback or commit flag for actions after this group. These are executed by Finish Execution action group. You can run them elevated by using the "with no impersonation" flags.

It's important to note that you cannot use the "with no impersonation" flags on these custom actions, however.

like image 30
notbad.jpeg Avatar answered Sep 28 '22 00:09

notbad.jpeg