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 a single line of code, made another build, and I started getting an error about .NET.
The target version of the .NET Framework in the project does not match the .NET Framework launch condition version '.NET Framework 3.5'. Update the version of the .NET Framework launch condition to match the target version of the .NET Framework in the Advanced Compile Options Dialog Box (VB) or the Application Page (C#, F#).
- Project -> Properties -> Application -> Target Framework (for each project in both Debug and Release)
- Project -> Properties -> Publish -> Prerequisites (confirmed .NET 3.5 and Windows Installer 3.1)
- Setup -> Launch Conditions -> .NET Framework
- Setup -> Properties -> Prerequisites
I have also reviewed the vdproj code for my installer, confirming the launch conditions were .NET 3.5:
"ComponentsUrl" = "8:"
"Items"
{
"{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Net.Framework.3.5.SP1"
{
"Name" = "8:.NET Framework 3.5 SP1"
"ProductCode" = "8:Microsoft.Net.Framework.3.5.SP1"
}
"{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Windows.Installer.3.1"
{
"Name" = "8:Windows Installer 3.1"
"ProductCode" = "8:Microsoft.Windows.Installer.3.1"
}
}
"ComponentsUrl" = "8:"
"Items"
{
"{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Net.Framework.3.5.SP1"
{
"Name" = "8:.NET Framework 3.5 SP1"
"ProductCode" = "8:Microsoft.Net.Framework.3.5.SP1"
}
"{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Windows.Installer.3.1"
{
"Name" = "8:Windows Installer 3.1"
"ProductCode" = "8:Microsoft.Windows.Installer.3.1"
}
}
"LaunchCondition"
{
"{A06ECF26-33A3-4562-8140-9B0E340D4F24}:_799EF2A78D074B669D0B30310FD56A67"
{
"Name" = "8:.NET Framework"
"Message" = "8:[VSDNETMSG]"
"FrameworkVersion" = "8:.NETFramework,Version=v3.5"
"AllowLaterVersions" = "11:FALSE"
"InstallUrl" = "8:http://go.microsoft.com/fwlink/?LinkId=131000"
}
}
Since I build for both an x86 and x64 compiler, I have two setup projects. The second one, for the x86 processor, does not get the .NET error. I have compared the code in its vdproj with this, and it looks the same.
I have found several threads on this issue, including a very good one here, but none of them have helped me resolve this issue. Any suggestions would be helpful.
EDIT
I changed everything to .NET 4.0 just to see if it made a difference, and the project built successfully. I changed it back, and it gave me the .NET version error again. I checked the vdproj file for any "4.0" reference, and only found it for the AspNetVersion, which also occured in the x86 version of the installer which works.
"AspNetVersion" = "8:4.0.30319.0"
I need to release with .NET 3.5, so this was just an exercise to see if changing the version to something else and back would resolve the issue.
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:
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.
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
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
To alter it through the UI (not a text editor). Taken from here.
If you then receive a message similar to the following:
Perform the following steps:
EDIT: Updated the Launch Conditions Editor icon description for different version of VS, as per the comments.
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.