HOW TO: Control System Restarts in a Setup Project That You Created by Using Visual Studio .NET

Article translations Article translations
Article ID: 827020 - View products that this article applies to.
Expand all | Collapse all

On This Page

SUMMARY

This step-by-step article describes how to control system restarts in a setup project that you create by using Microsoft Visual Studio .NET. To control system restarts, you must use Orca (a Microsoft Windows Installer Development Tool) to modify the property table of the Microsoft Windows Installer file that is created when you build your project. Orca is included with Microsoft Platform Software Development Kit (SDK).

It is a good idea to restart your computer if an installation replaces any files that are in use during the installation process. You can control system restarts in your Windows Installer file by specifying the value of the REBOOT property as Force.

Requirements

The following list outlines the recommended hardware, software, network infrastructure, and service packs that you need:
  • Microsoft Windows 2000, Microsoft Windows XP, or Microsoft Windows Server 2003
  • Microsoft Visual Studio .NET
  • Microsoft Platform Software Development Kit (SDK)
This article assumes that you are familiar with the following topics:
  • System Reboots
  • Visual Studio .NET Setup Projects
  • Orca.exe

Install Orca

To download and then install Platform SDK (including Orca), visit the following Microsoft Web site:
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
After you install Platform SDK, run the Orca.msi file to install Orca. This file is located in the Bin folder of the installation folder.

Create a Setup Project

  1. Start Visual Studio .NET.
  2. On the File menu, point to New, and then click Project.
  3. Under Project Types, click Setup and Deployment Projects.
  4. Under Templates, click Setup Project.
  5. In the Name text box, type MyRebooter.
  6. Click OK.

Add a File, and then Build Your Setup Project

  1. Create a file that is named Readme.txt. To do this, follow these steps:
    1. Start a text editor (such as Notepad).
    2. Type the following text in the text editor:
      When you install this application, you will be prompted to restart your computer.
    3. On the File menu, click Save.
    4. In the Save As dialog box, locate the folder where you created the MyRebooter project in step 6 of the "Create a Setup Project" section of this article.
    5. In the File name text box, type Readme.txt.
    6. Click Save.
  2. Switch to Visual Studio .NET.
  3. On the Project menu, point to Add, and then click File.
  4. In the Add Files dialog box, locate and then click the Readme.txt file that you created in step 1.
  5. Click Open.

    The Readme.txt file is added to the MyRebooter project.
  6. On the Build menu, click Build MyRebooter.

Modify the Windows Installer File for Your Project by Using Orca

  1. Start Orca.
  2. On the File menu, click Open.
  3. In the Open dialog box, locate and then click the MyRebooter.msi file that you built in step 6 of the "Add a File, and Then Build Your Setup Project" section of this article.

    The MyRebooter.msi file is located in a folder that is named Debug. This Debug folder is located in the MyRebooter folder where you created your MyRebooter setup project in step 6 of the "Create a Setup Project" section of this article.
  4. Click Open.

    The MyRebooter.msi file is opened for editing.
  5. In the left pane, click Property to select the property table.
  6. On the Tables menu, click Add Row.

    The Add Row dialog box appears.
  7. In the Property text box, type REBOOT.
  8. In the Name field, click Value.
  9. In the Value text box, type Force.
  10. Click OK.

    The REBOOT property and the associated value are added to the property table.
  11. On the File menu, click Save.
  12. On the File menu, click Exit to quit Orca.

Verify That Your Application Works

  1. In Microsoft Windows Explorer, locate the Setup.exe file that you built in step 6 of the "Add a File, and Then Build Your Setup Project" section of this article.

    The Setup.exe file is located in the same folder as your MyRebooter.msi file.
  2. Run the Setup.exe file.
  3. In the MyRebooter dialog box, click Next three times to start installing MyRebooter on your computer.
  4. On the Installation Complete page, click Close to quit your installation.

    The MyRebooter dialog box appears and prompts you to restart your computer.
  5. Click Yes to restart your computer.

REFERENCES

For more information, visit the following Microsoft Developer Network (MSDN) Web sites:
System Reboots
http://msdn2.microsoft.com/en-us/library/aa372059.aspx

REBOOT Property
http://msdn2.microsoft.com/en-us/library/aa371101.aspx

Setup Projects
http://msdn2.microsoft.com/en-us/library/996a3fxs(vs.71).aspx

Orca.exe
http://msdn2.microsoft.com/en-us/library/aa370557.aspx

Properties

Article ID: 827020 - Last Review: April 12, 2007 - Revision: 2.2
APPLIES TO
  • Microsoft Windows Installer 2.0
  • Microsoft Visual Studio .NET 2003 Enterprise Architect
  • Microsoft Visual Studio .NET 2003 Enterprise Developer
  • Microsoft Visual Studio .NET 2003 Academic Edition
  • Microsoft Visual Studio .NET 2002 Professional Edition
  • Microsoft Visual Studio .NET 2002 Enterprise Architect
  • Microsoft Visual Studio .NET 2002 Enterprise Developer
  • Microsoft Visual Studio .NET 2002 Academic Edition
  • Microsoft Platform Software Development Kit-January 2000 Edition
Keywords: 
kbtable kbsdk kbproperties kbmisctools kbpdwizard kbideproject kbsetup kbdeployment kbappsetup kbhowtomaster KB827020

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com