Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 992
identitycrisisuk Avatar asked Nov 30 '11 14:11

identitycrisisuk


People also ask

How do I continue installing after reboot?

To trigger an installation after reboot, we use the RunOnce registry keys. RunOnce registry keys call programs to run every time a user logs on, and given the Windows Installer package is per-user, it makes sense to make an individual install.


1 Answers

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.

like image 78
rmrrm Avatar answered Oct 12 '22 12:10

rmrrm