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



The information in this article applies to:

  • Microsoft Windows Installer
  • Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2003), Academic Edition
  • Microsoft Visual Studio .NET (2002), Professional Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2002), Academic Edition
  • Microsoft Platform Software Development Kit (SDK) 1.0

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.

back to the top

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
back to the top

Install Orca

To download and then install Platform SDK (including Orca), visit the following Microsoft Web site: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.

back to the top

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.
back to the top

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.
back to the top

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.
back to the top

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.
back to the top

Modification Type:MinorLast Reviewed:7/11/2005
Keywords:kbtable kbSDK kbProperties kbMiscTools kbPDWizard kbIDEProject kbsetup kbDeployment kbAppSetup kbHOWTOmaster KB827020 kbAudDeveloper