Target Version of the .NET Framework does not match Launch Condition

后端 未结 6 783
轮回少年
轮回少年 2021-02-01 02:06

I have a c# project that I am building in VS 2010. It references a C++ project through COM, which is also a part of the solution. Last Friday, I made a successful build, changed

相关标签:
6条回答
  • 2021-02-01 02:46
    • On main menu select "Project"
    • Select option " Properties"
    • A form will open, select "Build", click on button "Prerequisites", select your .Net version.
    0 讨论(0)
  • 2021-02-01 02:53

    To alter it through the UI (not a text editor). Taken from here.

    1) Select installer project

    2) In Solution Explorer or Solution Navigator click on the icon at the top of the panel "Launch Conditions Editor" (In VS2010 its the icon with binoculars, in VS2015 and VS2017 the icon is a sheet of paper with a filter in front of it (shout out to Mat and Bob Van de Vijver in the comments).

    3) Under Launch Conditions, Select ".Net framework" on the right in "Properties" Select "Version" you will see a drop down. change the framework to your target framework.

    4) Build and install.

    If you then receive a message similar to the following:

    WARNING: The version of the .NET Framework launch condition '.NET Framework 4' does not match the selected .NET Framework bootstrapper package. Update the .NET Framework launch condition to match the version of the .NET Framework selected in the Prerequisites Dialog Box.

    Perform the following steps:

    1) Right click the installer project and click 'properties'.

    2) Click on the 'Prerequisites' button.

    3) Change as desired.

    EDIT: Updated the Launch Conditions Editor icon description for different version of VS, as per the comments.

    0 讨论(0)
  • 2021-02-01 02:59

    I was also facing the same issue.I made a mistake that target frame work was different at all places.U can verify that at below mentioned places same framework should be selected.I am using VS2015. Place 1 - right click on Project-> Properties -> application -> target framework for me (.Net framework 4) you can select according to your project. Place 2 - Right click on installer project -> properties -> prerequisites-> select microsoft framework 4 (X86 and X64) for u it depends which framework you target. Place 3 - Right click on Installer project -> click on view-> launch condition -> .net Framework -> right click properties-> select >net framework 4. I was working with windows services and facing this issue while updating from vs 2010 to 2015.Hope it will help you.

    0 讨论(0)
  • 2021-02-01 03:02

    Even after setting the framework version and Setup project prerequisites in all the places mentioned above. The error continued to appear. I then looked in the setup project file and saw the previous NET framework version was still mentioned under the Configurations/Debug section, so in Visual Studio I set the compile mode back to Debug, repeated the same changes and that cleared the error for me.

    0 讨论(0)
  • 2021-02-01 03:04

    It turns out that the C++ code was also associated with .NET for some reason. I used this article to help me change the c++ .NET version from 4.0 to 3.5. The basic steps are

    1. Open the c++ project vcxproj in a text editor
    2. Find <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
      • This may need to be created under the Globals PropertyGroup
    3. Change 4.0 to 3.5
    4. Open the project in VS
    5. Right click the c++ project and select properties
    6. Select Common Properties and confirm that the version is 3.5
    7. Select Configuration Properties -> General
    8. Make sure the Platform Toolset is set to v90
    0 讨论(0)
  • 2021-02-01 03:06

    Had same problem as this project had been converted from 2008 to 2010.

    To change the bootstrapper, I opened the .csproj and manually removed instances from 3.5 in it:

    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
      <Visible>False</Visible>
      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
      <Install>false</Install>
    </BootstrapperPackage>
    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
      <Visible>False</Visible>
      <ProductName>.NET Framework 3.5 SP1</ProductName>
      <Install>false</Install>
    </BootstrapperPackage>
    

    Also, I found out you can just right click on the Setup and Deployment project, hit properties, go to prerequisites, and select the correct .NET framework.

    It was hard to find it, you have to click on the Prerequisites button.

    0 讨论(0)
提交回复
热议问题