6
votes

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)?

2
did u find the solution?kudlatiger
@kudlatiger: No. Not thru MSI/Wix. I ended up making a DLL that was included in the MSI that I could invoke my exported C++ function from during un-installation phase. And that's where I was able to close all open applications from.c00000fd

2 Answers

5
votes

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.

1
votes

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.