Friday, March 4, 2011

Reboot as last step in vdproj, how can I add it?

How can I add the reboot action to a vdproj? I need an MSI which restart the pc at the end of the installation. Thank you.

From stackoverflow
  • If you need to reboot, Windows Installer should detect it automatically. If you want to reboot as you are too lazy to start services manually, you will need to find some other way (I do not know of any easy way).

    uvts_cvs : In my case Windows Installer does not detect it automatically.
  • Just add the "REBOOT" property with the value "Force" which will prompt the user to reboot once setup is complete, or automatically reboot if there is no user interface.

    If you cannot do this in the vdjproj then just use Orca to edit the Property table of the MSI once the setup is built.

    If you want to force a reboot, you can set REBOOT=Force and REBOOTPROMPT=Suppress so that the user is not prompted.

    Alternatively you can use the ForceReboot action to reboot during the middle of installation or ScheduleReboot to schedule a reboot once the installation is complete. Again either of these actions can be added using Orca if you cannot do so in the vdjproj.

    You can do something like this using the following VBS

    Dim installer, database, view, result
    Set installer = CreateObject("WindowsInstaller.Installer")
    Set database = installer.OpenDatabase ("setup.msi", 1)
    Set view = database.OpenView ("INSERT INTO Property (Property, Value) VALUES ('REBOOT', 'Force')")
    view.Execute
    database.Commit
    Set database = nothing
    
    uvts_cvs : Thank you. How can I add the ForceReboot action to the vdproj by means of Visual Studio 2008? What is Orca?
    sascha : Orca is one of the tools that comes with the Windows Installer SDK. I'm not familar with Visual Studio (I just deal with MSI, I don't code) so I can't help you there sorry.
    Julien N : Is there a simple way to add a property automatically in a Visual Studio post build event ? (so I need a command line)

0 comments:

Post a Comment