[Solution 6 Answers] The version of the .NET Framework launch condition ‘.NET Framework 4’ does not match the selected .NET Framework bootstrapper package

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

  • 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:

Html Code
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<ProductName>.NET Framework 3.5 SP1</ProductName>

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.
READ  C program to add two numbers

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.

About the author

Venkatesan Prabu

Venkatesan Prabu

Wikitechy Founder, Author, International Speaker, and Job Consultant. My role as the CEO of Wikitechy, I help businesses build their next generation digital platforms and help with their product innovation and growth strategy. I'm a frequent speaker at tech conferences and events.