Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Whats the difference between <RequiredTargetFramework> and <targetframeworkversion>?

We upgraded our .net 3.5 projects (c#) to .net 4.0. When you look at the project file there are two tags that I'm trying to make sense out of:

<RequiredTargetFramework>3.5</RequiredTargetFramework>
<TargetFrameworkVersion>4.0</TargetFrameworkVersion>

Why are there two seemingly similar tags with different values?

like image 581
Micah Avatar asked Aug 11 '10 13:08

Micah


1 Answers

The <RequiredTargetFramework> element was already present in your 3.5 project. It's associated with the assembly <Reference> and only present on assemblies that are not available in .NET 2.0

I don't buy much stock in the single mention of it in MSDN, I don't see how batch building has anything to do assembly references. Nor is it used in any of the 3.5 MSBuild .target files. I think the IDE simply uses it to put the warning icon next to the reference in the References node when you change the Target Framework to a version less than what's needed to support the assembly.

There are other elements like this in a project file that don't affect MSBuild but have an effect in the IDE. Like <SubType> and <DependentUpon> in the <Compile> element.

like image 76
Hans Passant Avatar answered Sep 18 '22 22:09

Hans Passant