C# – How to prompt the user to reboot in a .NET installation

cinstallationnetwindows-installer

I'm using Visual Studio 2008 to write an installation, and I'm a completely new 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 I 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.

Best Answer

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')"