Wix安装程序问题:为什么RestartManager将Service标记为RMCritical而不是RMService [英] Wix Installer Problem: Why does RestartManager mark Service as RMCritical and not RMService

查看:94
本文介绍了Wix安装程序问题:为什么RestartManager将Service标记为RMCritical而不是RMService的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试阻止我们的wix安装程序在卸载时提示用户重新启动.我们的服务设置为要卸载,并在卸载时删除.不幸的是,RestartManager提示用户在InstallValidate操作期间需要重新启动.此操作在StopServices和DeleteServices操作之前进行.

I'm trying to prevent our wix installers from prompting the user for a reboot when uninstalling. Our services are set to be uninstalled and deleted on an uninstall. Unfortunately for us the RestartManager is prompting the user that a reboot will be required during the InstallValidate action. This action occurs well before the StopServices and DeleteServices actions.

检查日志,看来RestartManager认为我们的服务是关键过程:

Checking the logs, it seems that the RestartManager thinks that our service is a critical process:

检测到ID为1234,友好名称为'abc',服务简称为'xyz',类型为RmCritical且状态为1的应用程序正在使用文件."

"Detected the application with id 1234, friendly name 'abc', service short name 'xyz', of type RmCritical and status 1 holds files[s] in use."

这些服务是在本地系统帐户下安装和运行的.我不确定,但是我认为如果RestartManager返回RmService而不是RmCritical,那么它将不会提示重新启动.

The services are installed and running under the local system account. I'm not sure but I think if RestartManager was returning RmService instead of RmCritical then it wouldnt be prompting for a reboot.

非常感谢您的帮助.

MSDN指出,对于RMCritical: 由于无法关闭进程,因此需要重新启动系统才能完成安装.由于以下原因,无法关闭该过程.该过程可能是关键过程.当前用户可能无权关闭该进程.该进程可能属于启动重新启动管理器的主要安装程序.

MSDN states that for RMCritical: A system restart is required to complete the installation because a process cannot be shut down. The process cannot be shut down because of the following reasons. The process may be a critical process. The current user may not have permission to shut down the process. The process may belong to the primary installer that started the Restart Manager.

用户确实有权关闭服务,并且这些服务与msiexec无关,因此我只能假定我们的服务被认为是关键过程....但是为什么?

The user does have permission to shut down the services, and the services are not anything to do with msiexec so I can only assume that our service is thought to be a critical process.... but why?

推荐答案

您可以通过设置MSI属性MSIRESTARTMANAGERCONTROL =来禁止窗口的RestartManager. 禁用"(请参见此处的文档- http://msdn.microsoft.com/zh-CN/library/windows/desktop/aa370377(v = vs.85).aspx ).这种方法本身的唯一问题是,他们将看到正在使用文件"对话框(并被要求关闭可能正在使用这些文件/服务的所有应用程序),而不是提示用户重新启动对话框.在InstallExecute Sequence的InstallValidate标准操作期间显示此对话框.

You can suppress window's RestartManager by setting the MSI property MSIRESTARTMANAGERCONTROL= "Disable" (see documentation here - http://msdn.microsoft.com/en-us/library/windows/desktop/aa370377(v=vs.85).aspx). The only problem with this approach by itself is that instead of prompting users with a reboot-required dialog, they will see the file-in-use dialog (and be asked to shut down any applications that might be using those files/services). This dialog is displayed during the InstallValidate standard action of the InstallExecute Sequence.

如果您想绕开这两个对话框中的任何一个,可以在InstallValidate之前安排自定义操作,该操作在RestartManager有机会检查系统之前手动关闭所有正在运行的服务.这不遵循标准的MSI惯例,因为通常您会将修改系统的自定义操作标记为延迟"操作,但是MSI不允许在InstallValidate之前运行任何延迟的操作.因此,您必须将操作标记为立即",但是在代码中,您将继续操作并通过关闭服务来修改系统.此处的缺点是没有立即回滚操作之类的东西,因此,如果卸载/升级失败并回滚,则您停止的服务将保持停止状态.好处是,用户在卸载/升级过程中不必再看到任何其他对话框.

If you want a sneaky way around either of these dialogs you can schedule a custom action before InstallValidate that manually shuts down any running services before the RestartManager has a chance to inspect the system. This does not follow standard MSI practices because normally you would mark a custom action that modifies the system as a 'deferred' action, but MSI doesn't allow any deferred actions to run before InstallValidate. So, you would have to mark the action as 'immediate', but in the code you would go ahead and modify the system by shutting down the services. The drawback here is that there's no such thing as an immediate rollback action, so if your uninstall/upgrade fails and does a rollback the services you stopped will be left in a stopped state. The upside is that users never have to see any additional dialogs during their uninstall/upgrade.

这篇关于Wix安装程序问题:为什么RestartManager将Service标记为RMCritical而不是RMService的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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