.NET Platform Conditional Tags in .csproj

In addition to symbols you can use in code, one can also use TFMs in .csproj files for instance to decide which references to use depending on target framework, like so:

   <ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.4'">
      <PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.7.0" />

Here is the list of all the TFMs known today:

Target Framework TFM
.NET 5 (and .NET Core) netcoreapp1.0netcoreapp1.1netcoreapp2.0netcoreapp2.1netcoreapp2.2netcoreapp3.0netcoreapp3.1net5.0*
.NET Standard netstandard1.0netstandard1.1netstandard1.2netstandard1.3netstandard1.4netstandard1.5netstandard1.6netstandard2.0netstandard2.1
.NET Framework net11net20net35net40net403net45net451net452net46net461net462net47net471net472net48
Windows Store netcore [netcore45]netcore45 [win] [win8]netcore451 [win81]
.NET Micro Framework netmf
Silverlight sl4sl5
Windows Phone wp [wp7]wp7wp75wp8wp81wpa81
Universal Windows Platform uap [uap10.0]uap10.0 [win10] [netcore50]

To contact me, send an email anytime or leave a comment below.