简体   繁体   English

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

[英]prompt to reboot computer after installation completed

I am currently adding a deployment project to my C# solution which installs a windows service and I have been trying to find a property that will make the installer prompt the user to reboot the system once installation has completed. 我当前正在向我的C#解决方案中添加一个部署项目,该项目将安装Windows服务,并且我一直在尝试寻找一个属性,该属性将使安装程序在安装完成后提示用户重新引导系统。 I would prefer to simply set a property rather than create a small application that I run at the end of the install. 我宁愿只设置一个属性,而不是创建一个在安装结束时运行的小型应用程序。 if there is any code to restart then where i'll use this code in installer class or elsewhere? 如果有任何代码可以重启,那么我将在安装程序类或其他地方使用此代码?

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. 如果使用基于MSI的安装程序(如果使用VS安装项目,情况就是这种情况),则设置REBOOT = Force应该可以解决问题。

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. 但是,在正常情况下,安装程序会自行检测是否需要重新启动:如果您当前未收到重新启动提示,则这很好地表明您的服务无需重新启动就可以正常工作。

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). 您可能可以扩展设置逻辑以在安装服务后启动服务(如果需要,还可以启动任何自动启动GUI组件)。 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... 这比强制重新启动要友好得多,并且您将尽力帮助Windows摆脱其“您移动了鼠标,请重新启动”映像问题。


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. 编辑(2011年12月) @IdentityCrisisUK:有关设置REBOOT变量所涉及的确切步骤,请参见如何:控制系统在使用Visual Studio .NET创建的安装项目中重新启动 Use of Orca is required -- not sure why that has "already been ruled out", as it's a trivial postbuild step... 需要使用Orca -不知道为什么“已经被排除”了,因为这是不重要的后期构建步骤...

Use the REBOOT Property of WIX to restart prompt in the Product.wxs file of your Setup. 使用WIX的REBOOT属性重新启动安装程序的Product.wxs文件中的提示。 Syntax is :- 语法是:-

<Property Id="REBOOT" Value="Force"></Property>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM