.NET Standard.NET Standard

.NET Standard 是 .net api 的正式規格,可在多個 .net 執行中使用。.NET Standard is a formal specification of .NET APIs that are available on multiple .NET implementations. .NET Standard 背後的動機是在 .NET 生態系統中建立更高的一致性。The motivation behind .NET Standard was to establish greater uniformity in the .NET ecosystem. 不過,.NET 5 採用不同的方法來建立一致性,而這種新方法在許多情況下都不需要 .NET Standard。However, .NET 5 adopts a different approach to establishing uniformity, and this new approach eliminates the need for .NET Standard in many scenarios. 如需詳細資訊,請參閱本文稍後的 .net 5 及 .NET StandardFor more information, see .NET 5 and .NET Standard later in this article.

.NET 實作支援.NET implementation support

不同的 .NET 實作會以特定版本的 .NET Standard 為目標。The various .NET implementations target specific versions of .NET Standard. 每個 .NET 實作版本會宣佈它所支援的最高 .NET Standard 版本,此聲明表示它也會支援舊版。Each .NET implementation version advertises the highest .NET Standard version it supports, a statement that means it also supports previous versions. 例如,.NET Framework 4.6 會實 .NET Standard 1.3,這表示它會公開 .NET Standard 版1.0 至1.3 所定義的所有 Api。For example, .NET Framework 4.6 implements .NET Standard 1.3, which means that it exposes all APIs defined in .NET Standard versions 1.0 through 1.3. 同樣地,.NET Framework 4.6.1 會實 .NET Standard 1.4,而 .NET 5.0 則會執行 .NET Standard 2.1。Similarly, .NET Framework 4.6.1 implements .NET Standard 1.4, while .NET 5.0 implements .NET Standard 2.1.

下表列出支援每個 .NET Standard 版本的 最低 執行版本。The following table lists the minimum implementation versions that support each .NET Standard version. 這表示,較新版本的所列出的執行也支援對應的 .NET Standard 版本。That means that later versions of a listed implementation also support the corresponding .NET Standard version. 例如,.NET Core 2.1 和更新版本支援 .NET Standard 2.0 和更早版本。For example, .NET Core 2.1 and later versions support .NET Standard 2.0 and earlier versions.

.NET Standard.NET Standard 1.01.0 1.11.1 1.21.2 1.31.3 1.41.4 1.51.5 1.61.6 2.02.0 2.12.1
.NET Core 和 .NET 5.NET Core and .NET 5 1.01.0 1.01.0 1.01.0 1.01.0 1.01.0 1.01.0 1.01.0 2.02.0 3.03.0
.NET Framework 1.NET Framework 1 4.54.5 4.54.5 4.5.14.5.1 4.64.6 4.6.14.6.1 4.6.1 24.6.1 2 4.6.1 24.6.1 2 4.6.1 24.6.1 2 不適用3N/A3
MonoMono 4.64.6 4.64.6 4.64.6 4.64.6 4.64.6 4.64.6 4.64.6 5.45.4 6.46.4
Xamarin.iOSXamarin.iOS 10.010.0 10.010.0 10.010.0 10.010.0 10.010.0 10.010.0 10.010.0 10.1410.14 12.1612.16
Xamarin.MacXamarin.Mac 3.03.0 3.03.0 3.03.0 3.03.0 3.03.0 3.03.0 3.03.0 3.83.8 5.165.16
Xamarin.AndroidXamarin.Android 7.07.0 7.07.0 7.07.0 7.07.0 7.07.0 7.07.0 7.07.0 8.08.0 10.010.0
通用 Windows 平台Universal Windows Platform 10.010.0 10.010.0 10.010.0 10.010.0 10.010.0 10.0.1629910.0.16299 10.0.1629910.0.16299 10.0.1629910.0.16299 TBDTBD
UnityUnity 2018.12018.1 2018.12018.1 2018.12018.1 2018.12018.1 2018.12018.1 2018.12018.1 2018.12018.1 2018.12018.1 TBDTBD

1針對 .NET Framework 所列出的版本適用于 .NET Core 2.0 SDK 和更新版本的工具。舊版使用不同的對應來 .NET Standard 1.5 和更新版本。如果您無法升級至 Visual Studio 2017 或更新版本,您可以下載適用于 Visual Studio 2015 的 .Net Core 工具 的工具。1 The versions listed for .NET Framework apply to .NET Core 2.0 SDK and later versions of the tooling. Older versions used a different mapping for .NET Standard 1.5 and higher. You can download tooling for .NET Core tools for Visual Studio 2015 if you cannot upgrade to Visual Studio 2017 or a later version.

2列出的版本代表 NuGet 用來判斷指定 .NET Standard 程式庫是否適用的規則。雖然 NuGet 會將 .NET Framework 4.6.1 視為支援 .NET Standard 1.5 至2.0,但使用從 .NET Framework 4.6.1 專案針對這些版本所建立的 .NET Standard 程式庫有幾個問題。對於需要使用這類程式庫 .NET Framework 專案,建議您將專案升級為以 .NET Framework 4.7.2 或更高版本為目標。2 The versions listed here represent the rules that NuGet uses to determine whether a given .NET Standard library is applicable. While NuGet considers .NET Framework 4.6.1 as supporting .NET Standard 1.5 through 2.0, there are several issues with consuming .NET Standard libraries that were built for those versions from .NET Framework 4.6.1 projects. For .NET Framework projects that need to use such libraries, we recommend that you upgrade the project to target .NET Framework 4.7.2 or higher.

3 .NET Framework 不支援 .NET Standard 2.1。如需詳細資訊,請參閱 .NET Standard 2.1 的公告3 .NET Framework doesn't support .NET Standard 2.1. For more information, see the announcement of .NET Standard 2.1.

  • 資料行代表 .NET Standard 版本。The columns represent .NET Standard versions. 每個標題儲存格都是一個文件連結,該文件說明在該 .NET Standard 版本中新增了哪些 API。Each header cell is a link to a document that shows which APIs got added in that version of .NET Standard.
  • 資料列代表不同的 .NET 實作。The rows represent the different .NET implementations.
  • 每個資料格中的版本號碼分別表示以該 .NET Standard 版本為目標所需的「最低」** 實作版本。The version number in each cell indicates the minimum version of the implementation you'll need in order to target that .NET Standard version.
  • 若為互動式資料表,請參閱 .NET Standard 版本For an interactive table, see .NET Standard versions.

若要尋找可作為您目標的最新版 .NET Standard,請執行下列步驟:To find the highest version of .NET Standard that you can target, do the following steps:

  1. 尋找指出要作為您執行位置之 .NET 實作的資料列。Find the row that indicates the .NET implementation you want to run on.
  2. 在該資料列中,由左到右尋找指出您版本的資料行。Find the column in that row that indicates your version starting from right to left.
  3. 資料行標題會指出您目標所支援的 .NET Standard 版本。The column header indicates the .NET Standard version that your target supports. 您也可以將目標設為任何較低的 .NET Standard 版本。You may also target any lower .NET Standard version. 較高的 .NET Standard 版本也會支援您的實作。Higher .NET Standard versions will also support your implementation.
  4. 針對您想要作為目標的每個平台重複此程序。Repeat this process for each platform you want to target. 如果您有多個目標平台,應該從中挑選最舊的版本。If you have more than one target platform, you should pick the smaller version among them. 例如,如果您想要在 .NET Framework 4.8 和 .NET 5.0 上執行,您可以使用的最高 .NET Standard 版本 .NET Standard 2.0。For example, if you want to run on .NET Framework 4.8 and .NET 5.0, the highest .NET Standard version you can use is .NET Standard 2.0.

要以哪個 .NET Standard 版本作為目標Which .NET Standard version to target

選擇要設為目標的 .NET Standard 版本時,請考慮這種取捨:When choosing a .NET Standard version to target, consider this trade-off:

  • 版本愈高,可供程式庫的程式碼使用的 Api 就越多。The higher the version, the more APIs are available to your library's code.
  • 版本越低,應用程式和程式庫可以使用您的程式庫。The lower the version, the more apps and libraries can use your library.

建議您盡可能 以最低 版本的 .NET Standard 為目標。We recommend you target the lowest version of .NET Standard possible. 因此,在您找到可作為目標的最新 .NET Standard 版本之後,請依照下列步驟操作:So, after you find the highest .NET Standard version you can target, follow these steps:

  1. 以次舊的 .NET Standard 版本為目標並建置您的專案。Target the next lower version of .NET Standard and build your project.
  2. 如果您的專案建置成功,便重複步驟 1。If your project builds successfully, repeat step 1. 否則,請將目標重新設定為次新版本,這會是您應該使用的版本。Otherwise, retarget to the next higher version and that's the version you should use.

不過,以較低的 .NET Standard 版本作為目標會產生數個支援相依性。However, targeting lower .NET Standard versions introduces a number of support dependencies. 如果您的專案是以 .NET Standard 1.x 為目標,我們建議 同時 以 .NET Standard 2.0 作為目標。If your project targets .NET Standard 1.x, we recommend that you also target .NET Standard 2.0. 這樣可簡化程式庫使用者的相依性圖形,而這些使用者會在 .NET Standard 2.0 相容的執行中執行,並減少需要下載的套件數目。This simplifies the dependency graph for users of your library that run on .NET Standard 2.0 compatible implementations, and it reduces the number of packages they need to download.

.NET Standard 版本控制規則.NET Standard versioning rules

有兩個主要的版本控制規則:There are two primary versioning rules:

  • 累加:.NET Standard 版本就邏輯而言是同心圓:較新的版本會包含來自較舊版本的所有 API。Additive: .NET Standard versions are logically concentric circles: higher versions incorporate all APIs from previous versions. 版本之間並沒有任何重大變更。There are no breaking changes between versions.
  • 固定:.NET Standard 在出貨後,版本即凍結。Immutable: Once shipped, .NET Standard versions are frozen.

2.1 之後將不會有新的 .NET Standard 版本。There will be no new .NET Standard versions after 2.1. 如需詳細資訊,請參閱本文稍後的 .net 5 及 .NET StandardFor more information, see .NET 5 and .NET Standard later in this article.

規格Specification

.NET Standard 規格是一組標準化的 API。The .NET Standard specification is a standardized set of APIs. 此規格由 .NET 實作人員維護,具體而言即為 Microsoft (包括 .NET Framework、.NET Core 與 Mono) 和 Unity。The specification is maintained by .NET implementors, specifically Microsoft (includes .NET Framework, .NET Core, and Mono) and Unity.

正式成品Official artifacts

正式規格是一組 .cs 檔案,可定義屬於標準的 api。The official specification is a set of .cs files that define the APIs that are part of the standard. dotnet/standard 存放庫中的 ref 目錄定義 .NET Standard API。The ref directory in the dotnet/standard repository defines the .NET Standard APIs.

NETStandard.Library 中繼套件 (原始檔) 描述定義 (部分) 一或多個 .NET Standard 版本的程式庫集合。The NETStandard.Library metapackage (source) describes the set of libraries that define (in part) one or more .NET Standard versions.

像是 System.Runtime 等指定的元件,其描述:A given component, like System.Runtime, describes:

  • .NET Standard 的組件 (僅限其範圍)。Part of .NET Standard (just its scope).
  • 適用於該範圍的多個 .NET Standard 版本。Multiple versions of .NET Standard, for that scope.

為了更方便閱讀及支援特定開發人員案例 (例如使用編譯器),已提供衍生成品。Derivative artifacts are provided to enable more convenient reading and to enable certain developer scenarios (for example, using a compiler).

封裝表示Package representation

.NET Standard 參考組件的主要散發工具是 NuGet 套件。The primary distribution vehicle for the .NET Standard reference assemblies is NuGet packages. 傳遞實作的方法有許多種,各自適合每種 .NET 實作。Implementations are delivered in a variety of ways, appropriate for each .NET implementation.

NuGet 套件是以一個或多個架構為目標。NuGet packages target one or more frameworks. .NET Standard 套件以 ".NET Standard" 架構為目標。.NET Standard packages target the ".NET Standard" framework. 您可以使用 netstandard compact TFM (以 .NET Standard framework 為目標,例如 netstandard1.4) 。You can target the .NET Standard framework using the netstandard compact TFM (for example, netstandard1.4). 要在多個 .NET 上執行的程式庫應以此架構為目標。Libraries that are intended to run on multiple implementations of .NET should target this framework. 對大多數的 API 來說,會以 netstandard2.0 為目標,因為提供的 API 數目,超過 .NET Standard 1.6 與 2.0 之間的一倍。For the broadest set of APIs, target netstandard2.0 since the number of available APIs more than doubled between .NET Standard 1.6 and 2.0.

NETStandard.Library中繼套件會參考定義 .NET Standard 的一組完整 NuGet 套件。The NETStandard.Library metapackage references the complete set of NuGet packages that define .NET Standard. 若要將 netstandard 設為目標,最常見方式是參考這個中繼套件。The most common way to target netstandard is by referencing this metapackage. 它描述大約 40 種定義 .NET Standard 的 .NET 程式庫和相關 API,並提供其存取權。It describes and provides access to the ~40 .NET libraries and associated APIs that define .NET Standard. 您可以參考目標為 netstandard 的其他套件,以存取其他 API。You can reference additional packages that target netstandard to get access to additional APIs.

版本控制Versioning

規格不是單數的,而是以線性方式設定的一組 Api。The specification is not singular, but a linearly versioned set of APIs. 此標準的第一個版本會建立一組基準 API。The first version of the standard establishes a baseline set of APIs. 後續版本會新增 API,並繼承舊版所定義的 API。Subsequent versions add APIs and inherit APIs defined by previous versions. 從標準移除 Api 沒有任何已建立的布建。There is no established provision for removing APIs from the Standard.

.NET Standard 不是任何一個 .NET 執行特有的,也不符合任何這些執行的版本控制配置。.NET Standard is not specific to any one .NET implementation, nor does it match the versioning scheme of any of those implementations.

如先前所述,2.1 之後將不會有新的 .NET Standard 版本。As noted earlier, there will be no new .NET Standard versions after 2.1.

目標 .NET StandardTarget .NET Standard

您可以使用架構和中繼套件的組合來 建立 .NET Standard 程式庫 netstandard NETStandard.LibraryYou can build .NET Standard Libraries using a combination of the netstandard framework and the NETStandard.Library metapackage.

.NET Framework 相容性模式.NET Framework compatibility mode

從 .NET Standard 2.0 開始,引進了 .NET Framework 相容性模式。Starting with .NET Standard 2.0, the .NET Framework compatibility mode was introduced. 此相容性模式可讓 .NET Standard 專案可參考 .NET Framework 程式庫,就如同是為 .NET Standard 編譯一般。This compatibility mode allows .NET Standard projects to reference .NET Framework libraries as if they were compiled for .NET Standard. 並非所有專案都適合參考 .NET Framework 程式庫。例如,像是使用 Windows Presentation Foundation (WPF) API 的程式庫。Referencing .NET Framework libraries doesn't work for all projects, such as libraries that use Windows Presentation Foundation (WPF) APIs.

如需詳細資訊,請參閱 .NET Framework 相容模式For more information, see .NET Framework compatibility mode.

.NET Standard 程式庫與 Visual Studio.NET Standard libraries and Visual Studio

若要在 Visual Studio 中建立 .NET Standard 程式庫,請確定您已在 Windows 上安裝 Visual Studio 2019 或 Visual Studio 2017 15.3 版或更新版本,或在 macOS 上安裝 Visual Studio for Mac 7.1 版 或更新版本。In order to build .NET Standard libraries in Visual Studio, make sure you have Visual Studio 2019 or Visual Studio 2017 version 15.3 or later installed on Windows, or Visual Studio for Mac version 7.1 or later installed on macOS.

若在您專案中只需要使用 .NET Standard 2.0 程式庫,也可於 Visual Studio 2015 中執行。If you only need to consume .NET Standard 2.0 libraries in your projects, you can also do that in Visual Studio 2015. 但需要安裝 NuGet 用戶端 3.6 或更新版本。However, you need NuGet client 3.6 or higher installed. 您可從 NuGet下載頁面,下載 Visual Studio 2015 的 NuGet 用戶端。You can download the NuGet client for Visual Studio 2015 from the NuGet downloads page.

.NET 5 和 .NET Standard.NET 5 and .NET Standard

.NET 5 是 Microsoft 積極開發的 .NET 的實作為。.NET 5 is the implementation of .NET that Microsoft is actively developing. 它是單一產品,具有一組統一的功能和 Api,可用於 Windows 傳統型應用程式和跨平臺主控台應用程式、雲端服務和網站。It's a single product with a uniform set of capabilities and APIs that can be used for Windows desktop apps and cross-platform console apps, cloud services, and websites. .NET 5.0 tfm 會反映這範圍廣泛的案例:The .NET 5.0 TFMs reflect this broad range of scenarios:

  • net5.0

    這個 TFM 適用于隨處執行的程式碼。This TFM is for code that runs everywhere. 有幾個例外狀況,它只包含可跨平臺運作的技術。With a few exceptions, it includes only technologies that work cross-platform. 針對 .NET 5 程式碼, net5.0 取代 netcoreappnetstandard tfm。For .NET 5 code, net5.0 replaces both netcoreapp and netstandard TFMs.

  • net5.0-windows

    這是 作業系統特定 tfm 的範例,可將作業系統特定功能新增至所指的所有專案 net5.0This is an example of OS-specific TFMs that add OS-specific functionality to everything that net5.0 refers to.

何時將目標設為 net 5.0 與 netstandardWhen to target net5.0 vs. netstandard

若為目標的現有程式碼 netstandard ,則不需要將 TFM 變更為 net5.0For existing code that targets netstandard, there's no need to change the TFM to net5.0. .NET 5.0 會實 .NET Standard 2.1 及更早版本。.NET 5.0 implements .NET Standard 2.1 and earlier. 從 .NET Standard 重定為 .NET 5.0 的唯一原因是,要取得更多執行時間功能、語言功能或 Api 的存取權。The only reason to retarget from .NET Standard to .NET 5.0 would be to gain access to more runtime features, language features, or APIs. 例如,為了使用 c # 9,您需要將目標設為 .NET 5.0。For example, in order to use C# 9, you need to target .NET 5.0. 您可以使用多目標 .NET 5.0 和 .NET Standard 來存取較新的功能,但仍可將程式庫提供給其他 .NET 執行。You can multitarget .NET 5.0 and .NET Standard to get access to newer features and still have your library available to other .NET implementations.

以下是適用于 .NET 5 的新程式碼的一些指導方針:Here are some guidelines for new code for .NET 5:

  • 應用程式元件App components

    如果您要使用程式庫將應用程式細分成數個元件,建議您將目標設 net5.x 5.x 為您的應用程式可設為目標的最早 .net 5 版本。If you're using libraries to break down an application into several components, we recommend you target net5.x where 5.x is the earliest .NET 5 version that your application can target. 為了簡單起見,最好將構成應用程式的所有專案都保留在相同版本的 .NET 上。For simplicity, it's best to keep all projects that make up your application on the same version of .NET. 然後,您可以在任何地方採用相同的 BCL 功能。Then you can assume the same BCL features everywhere.

  • 可重複使用的程式庫Reusable libraries

    如果您要建立可重複使用的程式庫,而您打算在 NuGet 上寄出,請考慮在觸達和可用功能集之間的取捨。If you're building reusable libraries that you plan to ship on NuGet, consider the trade-off between reach and available feature set. .NET Standard 2.0 是 .NET Framework 所支援的最新版本,因此它會對相當大的功能集提供良好的觸及範圍。.NET Standard 2.0 is the latest version that is supported by .NET Framework, so it gives good reach with a fairly large feature set. 我們不建議將 .NET Standard 1.x 的目標設為目標,因為您會限制可用的功能集,以達到最大程度的增加。We don't recommend targeting .NET Standard 1.x, as you'd limit the available feature set for a minimal increase in reach.

    如果您不需要支援 .NET Framework,可以使用 .NET Standard 2.1 或 .NET 5。If you don't need to support .NET Framework, you could go with .NET Standard 2.1 or .NET 5. 建議您略過 .NET Standard 2.1,並直接移至 .NET 5。We recommend you skip .NET Standard 2.1 and go straight to .NET 5. 最廣泛使用的程式庫最後會有 .NET Standard 2.0 和 .NET 5 的多目標。Most widely used libraries will end up multi-targeting for both .NET Standard 2.0 and .NET 5. 支援 .NET Standard 2.0 可提供您最多的支援,而支援 .NET 5 可確保您可以針對已在 .NET 5 上的客戶運用最新的平臺功能。Supporting .NET Standard 2.0 gives you the most reach, while supporting .NET 5 ensures you can leverage the latest platform features for customers that are already on .NET 5.

.NET Standard 問題.NET Standard problems

以下是一些 .NET Standard 的問題,可協助說明為什麼 .NET 5 是在各平臺和工作負載之間共用程式碼的較佳方式:Here are some problems with .NET Standard that help explain why .NET 5 is the better way to share code across platforms and workloads:

  • 緩慢以新增 ApiSlowness to add new APIs

    .NET Standard 是建立成所有 .NET 執行都必須支援的 API 集,所以有建議的評論程式來加入新的 Api。.NET Standard was created as an API set that all .NET implementations would have to support, so there was a review process for proposals to add new APIs. 目標是只將可在所有目前和未來的 .NET 平臺中執行的 Api 標準化。The goal was to standardize only APIs that could be implemented in all current and future .NET platforms. 結果是,如果某項功能遺漏了特定版本,您可能必須先等幾年的時間,再將其新增至某個版本的標準。The result was that if a feature missed a particular release, you might have to wait for a couple of years before it got added to a version of the Standard. 然後,您會想要更長的時間,讓新版本的 .NET Standard 更加廣泛地受到支援。Then you'd wait even longer for the new version of .NET Standard to be widely supported.

    .Net 5 的解決方案: 當功能完成時,它已經可用於每個 .NET 5 應用程式和程式庫,因為程式碼基底是共用的。Solution in .NET 5: When a feature is implemented, it's already available for every .NET 5 app and library because the code base is shared. 而且因為 API 規格和其執行方式沒有任何差異,所以您可以利用新功能,比 .NET Standard 更快。And since there's no difference between the API specification and its implementation, you're able to take advantage of new features much quicker than with .NET Standard.

  • 複雜版本控制Complex versioning

    將 API 規格與其實作為區隔,會導致 API 規格版本與實版之間的複雜對應。The separation of the API specification from its implementations results in complex mapping between API specification versions and implementation versions. 這種複雜性在本文稍早所示的表格中很明顯,以及如何解讀的指示。This complexity is evident in the table shown earlier in this article and the instructions for how to interpret it.

    .Net 5 的解決方案: .NET 5.x API 規格與其執行之間沒有區隔。Solution in .NET 5: There's no separation between a .NET 5.x API specification and its implementation. 結果是簡化的 TFM 配置。The result is a simplified TFM scheme. 所有工作負載都有一個 TFM 前置詞: net5.0 用於程式庫、主控台應用程式和 web 應用程式。There's one TFM prefix for all workloads: net5.0 is used for libraries, console apps, and web apps. 唯一的變化是一個 尾碼,可指定特定平臺的平臺特定 api (例如) net5.0-windowsThe only variation is a suffix that specifies platform-specific APIs for a particular platform, such as net5.0-windows. 由於此 TFM 命名慣例,您可以輕鬆地分辨指定的應用程式是否可以使用指定的程式庫。Thanks to this TFM naming convention, you can easily tell whether a given app can use a given library. 不需要任何版本號碼對應的資料表,例如 .NET Standard 的資料表。No version number equivalents table like the one for .NET Standard is needed.

  • 平臺-執行時間不支援的例外狀況Platform-unsupported exceptions at run time

    .NET Standard 會公開平臺特定的 Api。.NET Standard exposes platform-specific APIs. 您的程式碼可能會在沒有錯誤的情況下進行編譯,並且看似可移植到任何平臺,即使它無法移植。Your code might compile without errors and appear to be portable to any platform even if it isn't portable. 當它在沒有指定 API 之執行的平臺上執行時,您會收到執行階段錯誤。When it runs on a platform that doesn't have an implementation for a given API, you get run-time errors.

    .Net 5 的解決方案: .NET 5 SDK 包含預設啟用的程式碼分析器。Solution in .NET 5: The .NET 5 SDK includes code analyzers that are enabled by default. 平臺相容性分析器會偵測到您想要在其上執行的平臺上不支援的 Api 的意外使用。The platform compatibility analyzer detects unintentional use of APIs that aren't supported on the platforms you intend to run on. 如需詳細資訊,請參閱 平臺相容性分析器For more information, see Platform compatibility analyzer.

.NET Standard 未淘汰.NET Standard not deprecated

可供多個 .NET 執行使用的程式庫仍需要 .NET Standard。.NET Standard is still needed for libraries that can be used by multiple .NET implementations. 建議您在下列案例中以 .NET Standard 為目標:We recommend you target .NET Standard in the following scenarios:

  • netstandard2.0 來在 .NET Framework 與其他所有 .net 的執行之間共用程式碼。Use netstandard2.0 to share code between .NET Framework and all other implementations of .NET.
  • netstandard2.1 來在 Mono、Xamarin 和 .Net Core 3.x 之間共用程式碼。Use netstandard2.1 to share code between Mono, Xamarin, and .NET Core 3.x.

請參閱See also