views:

728

answers:

3

I have an easy one for the install ninjas. I'm using Visual Studio 2008 to write an installation and I'm a complete newbie when it comes to installations. I've created an installation and successfully written some custom actions using a C# assembly. One action sets a RunOnce registry value, and now I need to prompt the user to reboot when the installation finishes, but I have no idea how. I've read the Installer class documentation but can't find any mention of rebooting.

I'm assuming I need to somehow get down to being able to call MsiSetProperty and set a REBOOT property, but I don't know how to do that from my .net installer project.

A: 

Are you implementing your installer using WiX (Windows Installer XML)?, if so, you need to add this:

<ScheduleReboot After="InstallFinalize"/>

If you're using the cut-down "Installer" project in VisualStudio, I'm not sure.... but this link here suggests a CScript command that seems to show how to inject a Msi property into the installer project, much as you want to do.

Ray Hayes
A: 

Why not just set the property in the MSI initally, rather than trying to update it at runtme?

VS2008 ships with WiX anyway, see http://robmensching.com/blog/posts/2007/11/26/Visual-Studio-ships-the-WiX-toolset for more details. That said I'm not a VS2008 user so I don't know if that's in addition, or in replacement to the previous VS setup projects.

sascha
+1  A: 

Thanks. I ended up using a post-build event to run a batch file with the following command. The hard part was tracking down WiRunSQL.vbs, which was in the "Windows SDK Components for Windows Installer Developers" download.

cscript "C:\Program Files\Microsoft SDKs\Windows\v6.0\Samples\SysMgmt\MSI\scripts\WiRunSQl.vbs" my.msi "INSERT INTO `Property`(`Property`, `Value`) VALUES ('REBOOT', 'F')"
Jeremy Mullin