Stopping the installation with a launch condition
A launch condition checks the user's computer to make sure that it can support our software. If it can't, the installation is automatically stopped before the user can go any further. For example, we may want to prevent the installation if the user doesn't have the necessary version of .NET installed. In this recipe, we'll do just that by adding a condition that checks for .NET Framework 4.5.
Windows 8 comes with .NET 4.5 preinstalled, but Windows 7 doesn't. We can use NetFxExtension
to check whether .NET 4.5 is preinstalled, and if it's missing, a message is displayed telling the user that the installation cannot continue. A nice thing about launch conditions is the ability to show the user a warning message explaining what went wrong.
Getting ready
To get started, perform the following steps:
Create a new setup project and name it
LaunchConditionInstaller
.Add a reference to
NetFxExtension
by right-clicking on the References node in Solution...