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

1

5

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:

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.

Rodneyrodolfo answered 30/11, 2011 at 14:51 Comment(0)
G
7

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.

Gerhart answered 30/11, 2011 at 19:4 Comment(6)
Ok thanks, that makes more sense now. So would creating a custom action be the only way of restarting when using a standard Setup Project without an extra step after building?Rodneyrodolfo
Yes, a custom action would be the only solution.Gerhart
Note that this is also nit advisable - some people like for example to atake some notes or must make a screenshot (i was once working oin a company like that) before restarting. Or so other things (move VM's to other machines). This is VERY MUCH NOT ADVICED to force a restart.Slattery
@Slattery setting the value to force does not actually force a restart, it forces a restart prompt. the user can choose to restart or not, but at least knows that they should.Quacksalver
@CosminPirvu is there a beginner guide for this cause I have no idea how and where to set these values?Unthoughtof
If you add REBOOT=Force in the property table in the MSI the MSI will spontaneously reboot the system on silent installation. It will also prompt you for reboot after every installation operation: install, repair, modify, uninstall, upgrade, etc... - I would not recommend this approach, although it will work with all the risks involved. On rebooting: Rebooting "ethics", ScheduleReboot.Computerize

© 2022 - 2024 — McMap. All rights reserved.