How To Use Launch Conditions in Visual Studio .NET (307374)



The information in this article applies to:

  • 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

This article was previously published under Q307374

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.
  1. 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

  2. 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.
  3. In the Launch Conditions window, select Requirements on a target node.
  4. On the Action menu, click Add File Launch Conditions. This will create a new search (an "AppSearch") under the Search Target Machine node and a new launch condition under the Launch Conditions node.
  5. 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

  6. Select a launch condition under the Launch Conditions node.
  7. 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:
  8. To build your deployment solution, click Build on the Build menu.
back to the top

REFERENCES

For more information on launch conditions, see the Microsoft Windows Installer SDK, which is available from the following Web site: back to the top

Modification Type:MajorLast Reviewed:1/4/2006
Keywords:kbDeployment kbHOWTOmaster KB307374 kbAudDeveloper