What is the simplest way to reboot after a Setup Project installation completes?

本秂侑毒 提交于 2021-02-08 15:47:06

问题


I hate to ask this question as I am aware that there are plenty of questions about it already, some coming very close to what I am wanting to do:

  • Reboot system from Setup project
  • prompt to reboot computer after installation completed

The first one seems to suggest that it is impossible without external software but the second question gives an answer that seems exactly what I want. But I don't really understand what it's referring to when it's suggested to set REBOOT=Force.

I read through the linked articles about properties, I don't know if it's just the way MSDN is written but I feel none the wiser about how I'm supposed to use them in a setup project. I'm still fairly new to C# in general and Setup Projects specifically.

Outside of properties it seems like the next easiest thing to do with the least external dependencies is to create a little C# application, which does nothing but shutdown the system. Then add a Custom Action to the Commit section to call this application. This seems like an overkill to me and does that mean that the useless application has to be part of the installation and left on the users machine?

I've found plenty of stuff about using WIX or Orca but I have my reasons for not using them (at the very least because I have to write Business Cases for any software used). I am not even trying to create a very complicated installer, it is just a few new EXEs being copied over and then restarting to be sure that the new EXE is used at startup. Though I am now thinking that it may not be worth the hassle of restarting and just call the new exe as a custom action.


回答1:


REBOOT is a predefined Windows Installer property: http://msdn.microsoft.com/en-us/library/windows/desktop/aa371101(v=vs.85).aspx

Installer properties are stored in Property table from the MSI database. So you can simply add a new row in Property table with this information:

  • Property - REBOOT
  • Value - Force

You can read more about installer properties here: http://msdn.microsoft.com/en-us/library/windows/desktop/aa372432(v=vs.85).aspx?ppud=4

Please note that Visual Studio setup projects do not support setting property values. So you can either edit the MSI with Orca to add the new row or switch to a different setup authoring tool.



来源:https://stackoverflow.com/questions/8327807/what-is-the-simplest-way-to-reboot-after-a-setup-project-installation-completes

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