'Adding launch conditions to Microsoft Visual Studio Installer Projects (check app is running)
I'm using Microsoft Visual Studio Installer Projects for my Hybrid Widndows Forms/WPF project. I need to make sure the user has closed the Application (an older version), if active, before the installer can proceed, can this be possible with a Visual Studio Installer Project?
All I've seen so far is that the installer adds by default a dependency to .NET Framework and it won't run unless the dependency is installed first.
Solution 1:[1]
UPDATE: Windows Installer-Avoid FileinUse dialog box when Installing a package for a list of possible, alternative options in addition to RestartManager support.
RestartManager: The RestartManager feature of MSI is designed to allow your application to gracefully shut down and restart itself during an installation process: How do I add support for Windows Restart Manager to my application? (Advanced Installer)
In essence: The whole idea is basically to prefer restarting applications rather than restarting the OS. To that end:
- Your application calls
RegisterApplicationRestart()
with a command line specified for its eventual restart - it "signs up" for restart management. - Your application watches for
WM_QUERYENDSESSION
messages and shuts down gracefully saving data in an appropriate way when told to do so. - Then RestartManager can restart the application when finished installing (restart can be disabled).
Importance: Just to state the obvious: rebooting a knowledge workers PC is a big deal (ethics of rebooting - no less - read towards bottom). This is why you should avoid reboots whenever possible. RestartManager support for your application can help (restart application rather than rebooting OS). This feature helps enormously for large scale deployment where you might target thousands of PCs. And please make sure your QA guys understand and know how to test the functionality / scenario relating to RestartManager.
Also avoid setting REINSTALLMODE to amus (force overwrite) - which can trigger unnecessary reboot prompts.
Links:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |