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. 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?
2 Answers
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.
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...
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...

- 52,000
- 11
- 64
- 62
-
Could you possibly expand on what you mean by this, I don't understand what you are referring to when you say set REBOOT=Force? Is this some setting in a Setup Project you can access in Visual Studio or are you talking about editing the created MSI file afterwards? I understand why it might not be best way to do things but in this case it is exactly what I want to do and it seems to be much more complicated than I expected. Using WIX or Orca have already been ruled out. – identitycrisisuk Nov 30 '11 at 13:56
Use the REBOOT Property of WIX to restart prompt in the Product.wxs file of your Setup. Syntax is :-
<Property Id="REBOOT" Value="Force"></Property>

- 351
- 1
- 8
- 20