Rebooting the system from the installation project

I am creating an installation project using Visual Studio. I want to reboot the system after successful installation.

I want it to be one time. I do not want to change the settings every time using any external tool / utility before delivering it to the client.

Can I customize the installation project?

How can i do this?

+4
source share
3 answers

Please do not joke, but I will not answer your specific question, however this is a way to restart the PC after installing msi.

Use WiX , it is much more flexible than VS, which is built into the configuration, and there is a plugin for VS.

If you use WiX, this is the code that triggers the reboot.

<InstallExecuteSequence> <ScheduleReboot After='InstallFinalize' /> </InstallExecuteSequence> 

Alternatively, you can create a transformation for your VS setup project, which contains only additional entries to initiate a reboot, then at any time when you create your project, all you need to do is apply the transformation, you can send it to clients in a batch file or similar.

ps remember that issuing a shell command as a custom action is not the best way to execute it. This will cause the machine to reboot and not return the correct exit code 3010 , so if someone tries to catch the exit code or does / norestart on the command line, the shell command will ignore this.

EDIT Once you have created the msi file, open its orca , and then add the necessary changes to the tables in schedulereboot. Save the changes as a conversion, then until the msi file changes a lot, you can simply apply the conversion to msi every time you run it.

Personaly I would not want to do this, as this is an additional step, and you should be able to do this in the source.

To add a reboot sequence to orca, go to the InstallExecuteSequence table and find the InstallFinalize entry. Add a new ScheduleReboot entry and enter a number in the sequence column, which is 1 more than the sequence from the InstallFinalize step.

+1
source

You can use ORCA for this.

Read more about this in the Microsoft HOW TO article:

http://support.microsoft.com/kb/827020

+2
source

Try the following:

Create an empty merge project in a separate solution and build it. This will create the msm file in the Debug or Release folder of the project.

Edit the resulting msm in Orca - by setting the REBOOT = Force property, as shown here . You will need to do this only once.

In your main solution, add the merge module to the installation project and create it. Since the merge module was built separately, it will save the reload property and merge it into your MSI.

+2
source

Source: https://habr.com/ru/post/1310472/


All Articles