Microsoft KB Archive/827020

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

Article ID: 827020

Article Last Modified on 4/12/2007

-

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

-



IN THIS TASK

 * SUMMARY
 * Requirements
 * Install Orca
 * Create a Setup Project
 * Add a File, and Then Build Your Setup Project
 * Modify the Windows Installer File for Your Project by Using Orca
 * Verify That Your Application Works
 * REFERENCES



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:

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.

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
 Create a file that is named Readme.txt. To do this, follow these steps:  Start a text editor (such as Notepad). Type the following text in the text editor:

When you install this application, you will be prompted to restart your computer.

 On the File menu, click Save. In the Save As dialog box, locate the folder where you created the MyRebooter project in step 6 of the &quot;Create a Setup Project&quot; section of this article. In the File name text box, type Readme.txt . Click Save.</li></ol> </li> Switch to Visual Studio .NET.</li> On the Project menu, point to Add, and then click File.</li> In the Add Files dialog box, locate and then click the Readme.txt file that you created in step 1.</li> Click Open.

The Readme.txt file is added to the MyRebooter project.</li> On the Build menu, click Build MyRebooter.</li></ol>

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 &quot;Add a File, and Then Build Your Setup Project&quot; 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 &quot;Create a Setup Project&quot; section of this article.
 * 1) Click Open.

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

The Add Row dialog box appears.
 * 1) In the Property text box, type REBOOT.
 * 2) In the Name field, click Value.
 * 3) In the Value text box, type Force.
 * 4) Click OK.

The REBOOT property and the associated value are added to the property table.
 * 1) On the File menu, click Save.
 * 2) 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 &quot;Add a File, and Then Build Your Setup Project&quot; section of this article.

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

The MyRebooter dialog box appears and prompts you to restart your computer.
 * 1) Click Yes to restart your computer.

back to the top

<div class="references_section">