安装完成后提示重新启动计算机

安装完成后提示重新启动计算机

本文介绍了安装完成后提示重新启动计算机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在将部署项目添加到我的C#解决方案中,安装Windows服务,我一直在试图寻找一个属性这将使安装程序提示用户重新引导系统一次安装已完成.我宁愿简单地设置一个属性而不是创建一个我在末尾运行的小型应用程序安装.如果有任何代码可以重新启动,那么我将在哪里使用此代码在安装程序类中还是其他地方?

I am currently adding a deployment project to my C# solution whichinstalls a windows service and I have been trying to find a propertythat will make the installer prompt the user to reboot the system onceinstallation has completed. I would prefer to simply set a propertyrather than create a small application that I run at the end of theinstall. if there is any code to restart then where i'll use this codein installer class or elsewhere?

推荐答案

如果您使用基于MSI的安装程序(如果使用VS安装项目,则为这种情况),请设置 REBOOT = Force 应该可以解决问题.

If you use a MSI-based installer (which would be the case if you're using a VS setup project), setting REBOOT=Force should do the trick.

在正常情况下,安装程序会自行检测是否需要重新启动:如果您当前未收到重新启动提示,则表明您的服务无需重新启动就可以正常工作.

Under normal circumstances, though, the installer will itself detect if a reboot is needed: if you're not currently getting a reboot prompt, that's a good indication your service should work just fine without that reboot.

您可以扩展设置逻辑,以在安装服务后启动服务(并在需要时启动任何自动启动GUI组件).这比强制重新启动要友好得多,并且您将尽力帮助Windows摆脱其您已移动鼠标,请重新启动"映像问题...

You may be able to extend your setup logic to start the service after installing it (and also to launch any auto-start GUI components if required). That's much friendlier than forcing a reboot, and you'll do your bit to help Windows get rid of its "you moved your mouse, please reboot" image problem...

编辑(2011年12月) @IdentityCrisisUK:请参见如何:控制系统在使用Visual Studio .NET 创建的安装项目中重新启动,以获取设置REBOOT变量所涉及的确切步骤.需要使用Orca -不知道为什么已经被排除"了,因为这是微不足道的后期构建步骤...

Edit (December 2011) @IdentityCrisisUK: see HOW TO: Control System Restarts in a Setup Project That You Created by Using Visual Studio .NET for the exact steps involved in setting the REBOOT variable. Use of Orca is required -- not sure why that has "already been ruled out", as it's a trivial postbuild step...

这篇关于安装完成后提示重新启动计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 23:44