首页 > 代码库 > Introducing .NET Standard

Introducing .NET Standard

https://blogs.msdn.microsoft.com/dotnet/2016/10/18/the-week-in-net-bond-the-gallery/

.NET Standard solves the code sharing problem for .NET developers across all platforms by bringing all the APIs that you expect and love across the environments that you need: desktop applications, mobile apps & games, and cloud services:

  • .NET Standard is a set of APIs that all .NET platforms have to implement. This unifies the .NET platforms and prevents future fragmentation.
  • .NET Standard 2.0 will be implemented by .NET Framework, .NET Core, and Xamarin. For .NET Core, this will add many of the existing APIsthat have been requested.
  • .NET Standard 2.0 includes a compatibility shim for .NET Framework binaries, significantly increasing the set of libraries that you can reference from your .NET Standard libraries.
  • .NET Standard will replace Portable Class Libraries (PCLs) as the tooling story for building multi-platform .NET libraries.
  • You can see the .NET Standard API definition in the dotnet/standard repo on GitHub.

.net跨平台带来的问题就是,基础类库无法通用

技术分享

 .NET Standard library因此诞生

技术分享

To summarize, we need .NET Standard for two reasons:

  1. Driving force for consistency. We want to have an agreed upon set of required APIs that all .NET platforms have to implement in order to gain access to the .NET library ecosystem.
  2. Foundation for great cross-platform tooling. We want a simplified tooling experience that allows you to target the commonality of all .NET platforms by choosing a single version number.

From a library targeting .NET Standard you’ll be able to reference two kinds of other libraries:(以后只需引用两种类型的库)

  • .NET Standard, if their version is lower or equal to the version you’re targeting.
  • Portable Class Libraries, if their profile can be mapped to a .NET Standard version and that version is lower or equal to the version you’re targeting.

图形化表示即:

技术分享

 

The table listed earlier shows which versions of .NET Framework supports which version of .NET Standard:各框架对标准的支持情况。

 1.41.51.62.0
.NET Framework4.6.14.6.2vNext4.6.1

.NET Standard 概要

技术分享

Introducing .NET Standard