Adding launch conditions to Microsoft Visual Studio Installer Projects (check app is running)

有些话、适合烂在心里 提交于 2019-12-12 23:07:35

问题


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.


回答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:

  1. Your application calls RegisterApplicationRestart() with a command line specified for its eventual restart - it "signs up" for restart management.
  2. Your application watches for WM_QUERYENDSESSION messages and shuts down gracefully saving data in an appropriate way when told to do so.
  3. 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, and this is why you should really add this RestartManager support to your application. It helps enormously for large scale deployment where you might target 16000 PCs. Also avoid setting REINSTALLMODE to amus (force overwrite) - which can trigger unnecessary reboot prompts. P.S: Make sure your QA guys understand and know how to test the functionality / scenario.


Links:

  • How does Windows Installer close an application during uninstall?
  • Windows Installer-Avoid FileinUse dialog box when Installing a package
  • In-use files not updated by MSI-installer (Visual Studio Installer project)
  • https://media.flexera.com/documents/minimizing_reboots_on_vista_systems.pdf


来源:https://stackoverflow.com/questions/54871192/adding-launch-conditions-to-microsoft-visual-studio-installer-projects-check-ap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!