受欢迎的博客标签

with .NET 5, .NET Core and .NET Standard are merged-.NET 5.0 class library

Published

But with .NET 5, .NET Core and .NET Standard are merged, and you don’t have to think about whether to use .NET Standard or .NET Core anymore. You just create a .NET 5.0 class library and you can use it with any .NET 5.0 application. The .csproj looks like this:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>
</Project>

But of course, such a .NET 5.0 class library cannot contain any OS-specific code, as it can be used in any .NET 5.0 application. Remember:

.NET 5.0 is a cross-platform framework

What if you want to build a WPF or WinForms project with .NET 5.0? Then you use the OS-specific TFM, in this case net5.0-windows.

There are also other OS-specific TFMs available, they are related to today’s Xamarin TFMs:

net5.0-android
net5.0-ios
net5.0-macos
net5.0-tvos
net5.0-watchos


With these TFMs, you can optionally specify a version after the OS, like for example net5.0-ios13.0.