MSI - don't require applications to close
How can I modify my MSI so it doesn't require ALL other running applications to close? Funny enough, if my application is closed manually before the uninstall is closed, it will not ask to close outlook, fir开发者_如何学JAVAefox etc.
The prompt is shown automatically by InstallValidate action, so you cannot modify the behavior. Instead you can prevent it by using a custom action which closes your application before InstallValidate.
Usually this is done by sending WM_CLOSE to the main application window (the application should handle this message for this to work).
The other applications (Outlook, Firefox etc.) are also shown in the prompt because Windows Installer is not very good at detecting running applications. It basically checks file dependencies (for example if multiple applications use the same DLLs or runtime), so false positives may occur.
MSI will automatically handle locked files using a reboot scenario. Asking to close applications is an attempt to prevent that reboot. You can suppress the reboot but then the file won't actually be replaced until after the reboot.
What exactly is the behavior you are looking for?
BTW, recommended reading:
FilesInUse Dialog
From there follow the link to InstallValidate and System Reboots.
As mrnx wrote here this check for running applications happens during InstallValidate. But stopping applications before it is not a good idea. Other checks might fail and MSI must be able to recover the system to the state it was before running MSI, including running applications.
Plus these checks run as "immediate", not "deferred".
IMO Custom Actions to stop applications should run just before "RemoveFiles" and as "deferred" to make sure it runs as admin.
Now to prevent dialog from showing the following property can be used:
<Property Id="MSIRESTARTMANAGERCONTROL" Value="Disable" />
In my understanding it will still fall back to FilesInUse dialog during RemoveFiles should they still be used at that time.
精彩评论