Microsoft KB Archive/307374

= How To Use Launch Conditions in Visual Studio .NET =

Article ID: 307374

Article Last Modified on 1/4/2006

-

APPLIES TO


 * 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

-



This article was previously published under Q307374



IN THIS TASK
SUMMARY
 * Types of Launch Conditions
 * Example: How to Set Up a Launch Condition

REFERENCES



SUMMARY
You can establish launch conditions in your setup solution that terminate the installation and display a message if certain conditions exist. This article describes the kinds of launch conditions that you can specify and provides an example of how to set up a launch condition.

back to the top

Types of Launch Conditions
The types of launch conditions that you can specify within the Microsoft .NET deployment environment are:
 * File launch condition

This condition determines if a file exists on a target computer. If the condition set is FALSE, the installation terminates.
 * Registry launch condition

This condition determines if a registry entry exists on a target computer. If the condition set is FALSE, the installation terminates.
 * Windows Installer launch condition

This condition determines if a Microsoft Windows Installer component exists on a target computer. If the condition set is FALSE, the installation terminates.
 * .NET Framework launch condition

This condition determines if the .NET runtime files are installed on a target computer. If the condition set is FALSE, the installation terminates.
 * Internet Information Services launch condition

This condition determines if Microsoft Internet Information Services is installed on a target computer. If the condition set is FALSE, the installation terminates.

back to the top

Example: How to Set Up a Launch Condition
The following steps show how to set up a launch condition that is based on whether a file exists on the target computer.  In Solutions Explorer, select your setup solution.For additional information on how to generate a setup solution for your application, click the article number below to view the article in the Microsoft Knowledge Base:

307353 How To Create a Setup Package by Using Visual Studio. NET

 In Solution Explorer, click the Launch Conditions icon. Use the Launch Conditions Editor that appears to specify the conditions that are required for installation on the target computer. In the Launch Conditions window, select Requirements on a target node. On the Action menu, click Add File Launch Conditions. This will create a new search (an &quot;AppSearch&quot;) under the Search Target Machine node and a new launch condition under the Launch Conditions node. In order to set the launch condition to check for the presence of a file on a target computer, you must first modify the Search property to reflect the file to search for. The Search property is located under the Search Target Machine node.For additional information about using the search, click the article number below to view the article in the Microsoft Knowledge Base:

307369 How To Use AppSearch in .NET Deployment

 Select a launch condition under the Launch Conditions node. If you want to modify the message that will appear if the launch condition evaluates to FALSE, do this in the Launch Conditions Property window. Also modify the Launch Condition Condition property, which causes the message to appear when the condition evaluates to FALSE. For this example, set this property to File Search.

NOTE: You can modify the Launch Condition Condition property so that it matches the type of launch condition that you want to use. For more information see:

Conditional Statement Syntax

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/conditional_statement_syntax.asp

</li> To build your deployment solution, click Build on the Build menu.</li></ol>

back to the top

<div class="references_section">