Share via


.NET Framework Launch Condition

When an application to be installed depends on the .NET Framework, a custom action in the Windows Installer file (.msi) checks the runtime version of the .NET Framework on the target computer, and sets a launch condition based on the result. The .NET Framework launch condition property Version in the Setup project specifies the exact runtime version that the installer requires on the target computer before it installs the application. For more information about Version, see Version Property (Launch Conditions).

For more information about how to add a .NET Framework launch condition, see How to: Add Predefined Launch Conditions.

Note

By default, the .NET Framework runtime is packaged together with your application and is automatically installed with the application if it is required. It is still a good idea to include the launch condition in case a user tries to run the .msi file directly, bypassing the bootstrapper. For more information, see Application Deployment Prerequisites.

Note

If you are using Visual Studio 2003 or earlier, you must enter a valid .NET Framework version number in the form N.N.NNNN or N.N.NNNNN (for example, 1.0.3705 or 2.0.50727). The launch condition might not evaluate correctly if you enter a version number that does not comply with this requirement, for example, 1.0.0.

In Visual Studio 2010, you can specify that your application can install and run with any version of the .NET Framework that exists on the end user computer. By default, the .NET Framework launch condition targets .NET Framework 4 Client Profile. If you are using a project template that targets .NET Framework version 4, change the .NET Framework launch condition to also target .NET Framework version 4. For more information, see How to: Add Predefined Launch Conditions.

In Visual Studio 2008 and earlier, if the version of the .NET Framework runtime specified in the Version property is not found, the installation is stopped. The user is presented with a Yes or No dialog box that contains the text specified in the Message property. Users who click Yes are redirected to the location that is specified in the InstallUrl property. (The default is a Microsoft Support Web site that contains a downloadable copy of the .NET Framework redistributable file, but you should specify a location that contains the specific version that is required by your application.)

In many cases, you will want to modify the InstallUrl property to specify your own location for the redistributable file. For example, if you are distributing your application on CD-ROM, you should include the redistributable file on the CD and change the InstallUrl property to a relative file path. If you change the InstallUrl property, you should also change the Message property to explain what is being installed and the location from which it is being installed.

See Also

Reference

AllowLaterVersions Property (Launch Conditions)

SupportedRuntimes Property

Message Property (Launch Conditions)

InstallUrl Property (Launch Conditions)

Properties for the Launch Conditions Editor

Concepts

Version Property (Launch Conditions)

Other Resources

Side-by-Side Execution

Using MSBuild toTarget Specific Versions of the .NET Framework

Launch Condition Management in Deployment