向 Microsoft Visual Studio 安装程序项目添加启动条件(检查应用程序正在运行) [英] Adding launch conditions to Microsoft Visual Studio Installer Projects (check app is running)

查看:67
本文介绍了向 Microsoft Visual Studio 安装程序项目添加启动条件(检查应用程序正在运行)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Microsoft Visual Studio 安装程序项目混合窗口窗体/WPF 项目.在安装程序继续之前,我需要确保用户已关闭应用程序(旧版本)(如果处于活动状态),这可以通过 Visual Studio 安装程序项目实现吗?

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?

到目前为止,我所看到的只是安装程序默认为 .NET Framework 添加了一个依赖项,除非先安装该依赖项,否则它不会运行.

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.

推荐答案

更新:Windows 安装程序 - 安装包时避免使用 FileinUse 对话框除了 RestartManager 支持.

<小时>

RestartManager:MSI 的 RestartManager 功能旨在让您的应用程序在安装过程中正常关闭并重新启动:如何为我的应用程序添加对 Windows 重启管理器的支持?(高级安装程序)


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. 您的应用程序使用为其最终重启指定的命令行调用 RegisterApplicationRestart() - 它注册"以进行重启管理.
  2. 您的应用程序会监视 WM_QUERYENDSESSION 消息,并在收到通知时以适当的方式优雅地关闭保存数据.
  3. 然后 RestartManager 可以在安装完成后重新启动应用程序(可以禁用重新启动).
  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).

<小时>

重要性:简单说明一下:重启知识型员工 PC 是一件大事,这就是为什么您应该真正将 RestartManager 支持添加到您的应用程序中.对于可能以 16000 台 PC 为目标的大规模部署,它非常有帮助.还要避免将 REINSTALLMODE 设置为 amus(强制覆盖) - 这会触发不必要的重启提示.P.S:确保您的 QA 人员了解并知道如何测试功能/场景.


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.

链接:

这篇关于向 Microsoft Visual Studio 安装程序项目添加启动条件(检查应用程序正在运行)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆