The error “the target version of the .NET Framework in the project does not match the .NET Framework launch condition version” occurs when a C# project referring C++ through COM is built.

Check the project properties for the setup and deployment project. Right click on the Setup project, select properties, go to prerequisites, and uncheck the selected .NET framework and check the required version. The same must be applied for all the projects including the setup and deployment project.

Follow the steps below to fix the error:

  • Open the c++ project vcxproj in a text editor
  • Find <TargetFrameworkVersion> </TargetFrameworkVersion>
  • This may need to be created under the Globals PropertyGroup
  • Change to required version
  • Open the project in VS
  • Right click the C++ project and select properties
  • Select Common Properties and confirm the version
  • Select Configuration Properties -> General
  • Make sure the Platform Toolset is set to v90
[ad type=”banner”]

  • The error can be fixed easily by double clicking the error message.
    A window shows up.
  • Then you can modify the properties of the different elements on the page by right clicking them and selecting properties.
  • Ensure that all the items on this page have the desired framework version. This works well in VS2010 version.

To modify the bootstrapper, open the .csproj and manually remove the instances from it:

[pastacode lang=”markup” manual=”%3CBootstrapperPackage%20Include%3D%22Microsoft.Net.Client.3.5%22%3E%0A%3CVisible%3EFalse%3C%2FVisible%3E%0A%3CProductName%3E.NET%20Framework%203.5%20SP1%20Client%20Profile%3C%2FProductName%3E%0A%3CInstall%3Efalse%3C%2FInstall%3E%0A%3C%2FBootstrapperPackage%3E%0A%3CBootstrapperPackage%20Include%3D%22Microsoft.Net.Framework.3.5.SP1%22%3E%0A%3CVisible%3EFalse%3C%2FVisible%3E%0A%3CProductName%3E.NET%20Framework%203.5%20SP1%3C%2FProductName%3E%0A%3CInstall%3Efalse%3C%2FInstall%3E%0A%3C%2FBootstrapperPackage%3E” message=”Html Code” highlight=”” provider=”manual”/]

Below are the steps to have a fix for this issue.

  • select installer project
  • click on the icon on top “Launch Conditions Editor”, the icon with binoculars.
  • Under Launch Conditions, select “.Net framework” on the right in “Properties” select “Version” to find a drop down and change the framework to the target framework.

This fix is introduced by the ClickOnce team. They say that there must be a mismatch somewhere between the launch condition of the .NET version and the selected prerequisite on the setup project’s properties. Both must point to the same framework version.

[ad type=”banner”]

Categorized in: