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:
and then this one:
To stop it from doing it, I added the following property:
<Property Id="MSIRESTARTMANAGERCONTROL" Value="Disable" />
But now the uninstaller shows this window:
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)?
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With