One of the most valuable features in Visual Studio deployment is the ability to set conditions for installation, allowing you to customize installations on a case-by-case basis. For example, you might want to install different files based on operating system version, or customize registry settings based on the value of an existing key, or even halt installation if a dependent application is not already installed on the target computer.
The deployment tools in Visual Studio support conditional deployment in two ways: through launch conditions and through the Condition property.
Launch conditions are used to evaluate a condition on a target computer and to halt installation if the condition is not met. Launch conditions can be set to check for the operating system version, existence of files, registry values, Window Installer components, the common language runtime, and Internet Information Services. For example, you might set a launch condition to check for a specific operating system version such as Windows 2000; if it is not found, you would display a message informing the user of the requirement and then installation would be halted. Launch conditions are specified in the Launch Conditions Editor. For more information, see.
The Condition property is used to evaluate properties exposed by Windows Installer or set by other elements in the installer. For example, Windows Installer exposes properties for the operating system version during installation. If you wanted to install a file only on Windows 2000 or greater, you would set the Condition property for that file to VersionNT>=500. Multiple conditions can be specified in a single Condition property; for example, VersionNT>=400 AND VersionNT<500 would specify any version of Windows NT 4, but not Windows 2000. Conditions can be set for files, folders, registry entries, and custom actions. For more information, see.