.NET Core和。net标准类库项目类型的区别是什么?

时间:2023-01-19 00:16:25

In Visual Studio, there are at least 3 different types of class library you can create:

在Visual Studio中,至少可以创建3种不同类型的类库:

  • Class Library (.NET Framework)
  • 类库(。净框架)
  • Class Library (.NET Standard)
  • 类库(。净标准)
  • Class Library (.NET Core)
  • 类库(。净核心)

While the first is what we've been using for years, a major point of confusion I've been having is when to use the .NET Standard and .NET Core class library types. I've been bitten by this recently when attempting to multi-target different framework versions, and creating a unit test project.

第一个是我们多年来一直在使用的,但我一直困惑的一个主要问题是什么时候使用。net标准和。net Core类库类型。最近,当我尝试多目标不同的框架版本并创建单元测试项目时,我就被这个问题困扰了。

So, what is the difference between Class Library (.NET Standard) and Class Library (.NET Core), why do both exist, and when should we use one over the other?

那么类库(。和类库(。为什么两者都存在,我们应该在什么时候使用它们?

6 个解决方案

#1


255  

When should we use one over the other?

我们什么时候应该使用一个而不是另一个?

The decision is a trade-off between compatibility and API access.

决定是在兼容性和API访问之间进行权衡。

Use a .NET Standard library when you want to increase the number of apps that will be compatible with your library, and you are okay with a decrease in the .NET API surface area your library can access.

当你想增加与你的库兼容的应用程序的数量时,可以使用。net标准库,你可以减少你的库可以访问的。net API表面积。

Use a .NET Core library when you want to increase the .NET API surface area your library can access, and you are okay with allowing only .NET Core apps to be compatible with your library.

当你想增加你的库可以访问的。net API表面积时,使用。net Core库,你可以只允许。net核心应用程序与你的库兼容。

For example, a library that targets .NET Standard 1.3 will be compatible with apps that target .NET Framework 4.6, .NET Core 1.0, Universal Windows Platform 10.0, and any other platform that supports .NET Standard 1.3. The library will not have access to some parts of the .NET API, though. For instance, the Microsoft.NETCore.CoreCLR package is compatible with .NET Core but not with .NET Standard.

例如,一个以。net标准1.3为目标的库将与以。net Framework 4.6、。net Core 1.0、通用Windows平台10.0和任何其他支持。net标准1.3的平台兼容。但是,该库不能访问。net API的某些部分。例如,Microsoft.NETCore。CoreCLR包与。net Core兼容,但不符合。net标准。

What is the difference between Class Library (.NET Standard) and Class Library (.NET Core)?

类库之间的区别是什么?和类库(。网络核心)?

The Package-based frameworks section here describes the difference.

这里基于包的框架部分描述了差异。

Compatibility: Libraries that target .NET Standard will run on any .NET Standard compliant runtime, such as .NET Core, .NET Framework, Mono/Xamarin. On the other hand, libraries that target .NET Core can only run on the .NET Core runtime.

兼容性:以。net标准为目标的库将在任何。net标准运行时运行,比如。net Core、。net框架、Mono/Xamarin。另一方面,以。net Core为目标的库只能在。net Core运行时上运行。

API Surface Area: .NET Standard libraries come with everything in NETStandard.Library whereas .NET Core libraries come with everything in Microsoft.NETCore.App. The latter includes approximately 20 additional libraries, some of which we can add manually to our .NET Standard library (such as System.Threading.Thread) and some of which are not compatible with the .NET Standard (such as Microsoft.NETCore.CoreCLR).

API表面积:。net标准库包含了NETStandard的所有内容。而。net核心库则包含了Microsoft.NETCore.App中的所有内容。后者包括大约20个额外的库,其中一些我们可以手工添加到。net标准库(比如system . thread)中,而另一些库与。net标准不兼容(比如microsoft . net . corcoreclr)。

Also, .NET Core libraries specify a runtime and come with an application model. That's important, for instance, to make unit test class libraries runnable.

此外,. net核心库还指定了一个运行时,并附带了一个应用程序模型。这很重要,例如,让单元测试类库可以运行。

Why do both exist?

为什么都存在吗?

Ignoring libraries for a moment, the reason that .NET Standard exists is for portability; it defines a set of APIs that .NET platforms agree to implement. Any platform that implements a .NET Standard is compatible with libraries that target that .NET Standard. One of those compatible platforms is .NET Core.

暂时忽略库,.NET标准存在的原因在于可移植性;它定义了一组。net平台同意实现的api。任何实现。net标准的平台都与以。net标准为目标的库兼容。其中一个兼容的平台是。net Core。

Coming back to libraries, the .NET Standard library templates exist to run on multiple runtimes (at the expense of API surface area). Obversely, the .NET Core library templates exist to access more API surface area (at the expense of compatibility) and to specify a platform against which to build an executable.

回到库,. net标准库模板存在于多个运行时上(以牺牲API表面积为代价)。相反,. net核心库模板的存在是为了访问更多的API表面积(以牺牲兼容性为代价),并指定一个平台来构建可执行文件。

#2


157  

TL;DR A .Net Core Class Library is built upon the .Net Standard. If you want to implement a library that is portable to the .Net Framework, .Net Core and Xamarin, choose a .Net Standard Library

net核心类库建立在。net标准之上。如果您想实现一个可移植到。net框架、。net Core和Xamarin的库,请选择一个。net标准库

.Net Core will ultimately implement .Net Standard 2 (as will Xamarin and .Net Framework)

.Net Core最终将实现。net标准2 (Xamarin和。net框架也是)

.Net Core, Xamarin and .Net Framework can, therefore, be identified as flavours of .Net Standard

因此。net Core、Xamarin和。net框架可以被定义为。net标准的风格

To future-proof your applications for code sharing and reuse , you would rather implement .Net Standard libraries.

为了保证应用程序的代码共享和重用,您宁愿实现。net标准库。

Microsoft also recommends that you use .NET Standard instead of Portable Class Libraries.

微软还建议使用。net标准而不是可移植类库。

To quote MSDN as an authoritative source, .Net Standard is intended to be One Library to Rule Them All. As pictures are worth a thousand words, the following will make things very clear:

要引用MSDN作为一个权威来源,. net标准旨在成为一个库来管理它们。因为图片胜过千言万语,下面的内容将会非常清晰:

1. Your current application scenario (fragmented)

1。您当前的应用程序场景(片段)

Like most of us, you are probably in the situation below: (.Net Framework, Xamarin and now .Net Core flavoured applications)

就像我们大多数人一样,你可能处于以下情况:Net框架、Xamarin以及现在的。Net核心风味应用程序)

.NET Core和。net标准类库项目类型的区别是什么?

2. What the .Net Standard Library will enable for you (cross-framework compatibility)

2。.Net标准库将为您提供什么(跨框架兼容性)

Implementing a .Net Standard Library allows code sharing across all these different flavours:

实现。net标准库允许跨所有这些不同风格的代码共享:

.NET Core和。net标准类库项目类型的区别是什么?

For the impatient: TL;DR

耐心:TL,博士

  1. .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:
  2. .NET标准解决了。net开发人员在所有平台上的代码共享问题,它提供了所有您期望和喜欢的api,包括桌面应用程序、移动应用程序和游戏以及云服务:
  3. .NET Standard is a set of APIs that all .NET platforms have to implement. This unifies the .NET platforms and prevents future fragmentation.
  4. . net标准是所有。net平台都必须实现的一组api。这统一了。net平台,防止了将来的碎片化。
  5. .NET Standard 2.0 will be implemented by .NET Framework, .NET Core, and Xamarin. For .NET Core, this will add many of the existing APIs that have been requested.
  6. . net标准2.0将由。net Framework、。net Core和Xamarin实现。对于。net Core,这将添加许多已经被请求的现有api。
  7. .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.
  8. . net标准2.0包含了。net框架二进制文件的兼容性shim,显著增加了可以从。net标准库中引用的库集。
  9. .NET Standard will replace Portable Class Libraries (PCLs) as the tooling story for building multi-platform .NET libraries.
  10. . net标准将取代可移植类库作为构建多平台。net库的工具。

For a table to help understand what the highest version of .NET Standard that you can target, based on which .NET platforms you intend to run on, head over here.

对于一个表,可以帮助理解您可以针对的. net标准的最高版本,基于您想要运行的。net平台。

Sources: MSDN: Introducing .Net Standard

来源:MSDN:介绍。net标准

#3


55  

So the short answer would be:

简而言之,答案是:

IAnimal == .NetStandard (General)
ICat == .NetCore (Less General)
IDog == .NetFramework (Specific / oldest and has the most features)

#4


42  

.Net Framework and .Net Core are two different implementations of the .Net runtime. Both Core and Framework (but especially Framework) have different profiles that include larger or smaller (or just plain different) selections of the many APIs and assemblies Microsoft has created for .Net, depending on where they are installed and in what profile. For example, there are some different APIs available in Universal Windows apps than in the "normal" Windows profile. Even on Windows, you might have the "Client" profile vs the "Full" profile. Additionally, there are other implementations (like Mono) that have their own sets of libraries.

. net框架和. net核心是。net运行时的两个不同的实现。Core和Framework(尤其是Framework)都有不同的配置文件,其中包括Microsoft为. net创建的许多api和程序集的大或小(或仅仅是不同)选择,这取决于它们安装的位置和配置文件。例如,与“普通”Windows配置文件相比,通用Windows应用程序中有一些不同的api。甚至在Windows上,你可能有“客户”配置文件和“完整”配置文件。此外,还有其他具有自己的库集的实现(如Mono)。

.Net Standard is a specification for which sets of API libraries and assemblies must be available. An app written for .Net Standard 1.0 should be able to compile and run with any version of Framework, Core, Mono, etc, that advertises support for the .Net Standard 1.0 collection of libraries. Similar is true for .Net Standard 1.1, 1.5, 1.6, 2.0, etc. As long as the runtime provides support for that version of Standard, you can compile and run there.

. net标准是必须提供API库和程序集的规范。为。net标准1.0编写的应用程序应该能够编译并运行任何版本的框架、核心、Mono等等,这些都支持。net标准1.0库集合。对于。net标准1.1、1.5、1.6、2.0等等,同样适用。只要运行时提供了对标准版本的支持,您就可以在那里编译和运行。

A project targeted at a version of Standard will not be able to make use of features that are not included in that revision of the standard. This doesn't mean you can't take dependencies on other assemblies, or APIs published by other vendors (ie: items on NuGet). But it does mean that any dependencies you take must also include support for your version of .Net Standard. .Net Standard is evolving quickly, but it's still new enough, and cares enough about some of the smaller runtime profiles, that this limitation can feel stifling.

针对标准版本的项目将不能使用标准修订中没有包括的特性。这并不意味着您不能依赖于其他程序集或其他供应商发布的api(例如:NuGet上的项目)。但是,这确实意味着,任何依赖项都必须包括对。net标准版本的支持。

On the other hand, an app targeted at Standard should be able to be used in more deployment situations, since in theory it can run with Core, Framework, Mono, etc. For a class library project looking for wide distribution, that's an attractive promise. For a class library project used mainly for internal purposes, it may not be as much of a concern.

另一方面,针对Standard的应用程序应该能够在更多的部署情况下使用,因为理论上它可以使用Core、Framework、Mono等。对于一个类库项目来说,寻找广泛的发行,这是一个很有吸引力的前景。对于主要用于内部目的的类库项目,它可能不那么重要。

.Net Standard can also be useful in situations where the SysAdmin team is wanting to move from ASP.Net on Windows to ASP.Net for .Net Core on Linux for philosophical or cost reasons, but the Development team wants to continue working against .Net Framework in Visual Studio on Windows.

. net标准在SysAdmin团队希望从ASP迁移的情况下也很有用。Net在Windows上的ASP。Net在Linux上的核心是出于哲学或成本方面的原因,但是开发团队希望在Windows的Visual Studio中继续针对。Net框架进行工作。

#5


2  

.Net Standard exists mainly to improve code sharing and make the APIs available in each .Net implementation more consistent.

. net标准的存在主要是为了改进代码共享,使每个. net实现中的api更加一致。

While creating Libraries we can have target as.Net Standard 2.0 so that the library created would be compaitible with different versions of .Net Framework including .Net Core,Mono..

在创建库时,我们可以将目标设置为as。Net标准2.0,使所创建的库可以与不同版本的。Net框架(包括。Net Core,Mono)兼容。

#6


0  

.NET Standard: Think of it as a big standard library. When using this as a dependency you can only make libraries (.DLLs), not executables. A library made with .NET standard as a dependency can be added to a Xamarin.Android, a Xamarin.iOS, a .NET Core Windows/OSX/Linux project.

。net标准:把它看作一个大型的标准库。当使用它作为依赖项时,您只能创建库(. dll),而不是可执行的。使用. net标准作为依赖项的库可以添加到Xamarin中。Xamarin的Android。iOS,一个。net核心的Windows/OSX/Linux项目。

.NET Core: Think of it as the continuation of the old .NET framework, just it's opensource and some stuff is not yet implemented and others got deprecated. It extends the .NET standard with extra functions, but only runs on Desktops. When adding this as a dependency you can make runnable apps on Windows, Linux and OSX. (Although console only for now, no GUIs). So .NET Core = .NET Standard + Desktop specific stuff.
Also UWP uses it and the new ASP.NET core uses it as a dependency too.

. net Core:把它看作是旧的。net框架的延续,只是它是开源的,有些东西还没有实现,有些东西已经过时了。它用额外的功能扩展了。net标准,但只在桌面上运行。当将它作为一个依赖项添加时,您可以在Windows、Linux和OSX上创建可运行的应用程序。(虽然暂时只能控制台,没有gui)。net Core =。net标准+桌面特定的东西。UWP也使用它和新的ASP。NET core也将它用作一个依赖项。

#1


255  

When should we use one over the other?

我们什么时候应该使用一个而不是另一个?

The decision is a trade-off between compatibility and API access.

决定是在兼容性和API访问之间进行权衡。

Use a .NET Standard library when you want to increase the number of apps that will be compatible with your library, and you are okay with a decrease in the .NET API surface area your library can access.

当你想增加与你的库兼容的应用程序的数量时,可以使用。net标准库,你可以减少你的库可以访问的。net API表面积。

Use a .NET Core library when you want to increase the .NET API surface area your library can access, and you are okay with allowing only .NET Core apps to be compatible with your library.

当你想增加你的库可以访问的。net API表面积时,使用。net Core库,你可以只允许。net核心应用程序与你的库兼容。

For example, a library that targets .NET Standard 1.3 will be compatible with apps that target .NET Framework 4.6, .NET Core 1.0, Universal Windows Platform 10.0, and any other platform that supports .NET Standard 1.3. The library will not have access to some parts of the .NET API, though. For instance, the Microsoft.NETCore.CoreCLR package is compatible with .NET Core but not with .NET Standard.

例如,一个以。net标准1.3为目标的库将与以。net Framework 4.6、。net Core 1.0、通用Windows平台10.0和任何其他支持。net标准1.3的平台兼容。但是,该库不能访问。net API的某些部分。例如,Microsoft.NETCore。CoreCLR包与。net Core兼容,但不符合。net标准。

What is the difference between Class Library (.NET Standard) and Class Library (.NET Core)?

类库之间的区别是什么?和类库(。网络核心)?

The Package-based frameworks section here describes the difference.

这里基于包的框架部分描述了差异。

Compatibility: Libraries that target .NET Standard will run on any .NET Standard compliant runtime, such as .NET Core, .NET Framework, Mono/Xamarin. On the other hand, libraries that target .NET Core can only run on the .NET Core runtime.

兼容性:以。net标准为目标的库将在任何。net标准运行时运行,比如。net Core、。net框架、Mono/Xamarin。另一方面,以。net Core为目标的库只能在。net Core运行时上运行。

API Surface Area: .NET Standard libraries come with everything in NETStandard.Library whereas .NET Core libraries come with everything in Microsoft.NETCore.App. The latter includes approximately 20 additional libraries, some of which we can add manually to our .NET Standard library (such as System.Threading.Thread) and some of which are not compatible with the .NET Standard (such as Microsoft.NETCore.CoreCLR).

API表面积:。net标准库包含了NETStandard的所有内容。而。net核心库则包含了Microsoft.NETCore.App中的所有内容。后者包括大约20个额外的库,其中一些我们可以手工添加到。net标准库(比如system . thread)中,而另一些库与。net标准不兼容(比如microsoft . net . corcoreclr)。

Also, .NET Core libraries specify a runtime and come with an application model. That's important, for instance, to make unit test class libraries runnable.

此外,. net核心库还指定了一个运行时,并附带了一个应用程序模型。这很重要,例如,让单元测试类库可以运行。

Why do both exist?

为什么都存在吗?

Ignoring libraries for a moment, the reason that .NET Standard exists is for portability; it defines a set of APIs that .NET platforms agree to implement. Any platform that implements a .NET Standard is compatible with libraries that target that .NET Standard. One of those compatible platforms is .NET Core.

暂时忽略库,.NET标准存在的原因在于可移植性;它定义了一组。net平台同意实现的api。任何实现。net标准的平台都与以。net标准为目标的库兼容。其中一个兼容的平台是。net Core。

Coming back to libraries, the .NET Standard library templates exist to run on multiple runtimes (at the expense of API surface area). Obversely, the .NET Core library templates exist to access more API surface area (at the expense of compatibility) and to specify a platform against which to build an executable.

回到库,. net标准库模板存在于多个运行时上(以牺牲API表面积为代价)。相反,. net核心库模板的存在是为了访问更多的API表面积(以牺牲兼容性为代价),并指定一个平台来构建可执行文件。

#2


157  

TL;DR A .Net Core Class Library is built upon the .Net Standard. If you want to implement a library that is portable to the .Net Framework, .Net Core and Xamarin, choose a .Net Standard Library

net核心类库建立在。net标准之上。如果您想实现一个可移植到。net框架、。net Core和Xamarin的库,请选择一个。net标准库

.Net Core will ultimately implement .Net Standard 2 (as will Xamarin and .Net Framework)

.Net Core最终将实现。net标准2 (Xamarin和。net框架也是)

.Net Core, Xamarin and .Net Framework can, therefore, be identified as flavours of .Net Standard

因此。net Core、Xamarin和。net框架可以被定义为。net标准的风格

To future-proof your applications for code sharing and reuse , you would rather implement .Net Standard libraries.

为了保证应用程序的代码共享和重用,您宁愿实现。net标准库。

Microsoft also recommends that you use .NET Standard instead of Portable Class Libraries.

微软还建议使用。net标准而不是可移植类库。

To quote MSDN as an authoritative source, .Net Standard is intended to be One Library to Rule Them All. As pictures are worth a thousand words, the following will make things very clear:

要引用MSDN作为一个权威来源,. net标准旨在成为一个库来管理它们。因为图片胜过千言万语,下面的内容将会非常清晰:

1. Your current application scenario (fragmented)

1。您当前的应用程序场景(片段)

Like most of us, you are probably in the situation below: (.Net Framework, Xamarin and now .Net Core flavoured applications)

就像我们大多数人一样,你可能处于以下情况:Net框架、Xamarin以及现在的。Net核心风味应用程序)

.NET Core和。net标准类库项目类型的区别是什么?

2. What the .Net Standard Library will enable for you (cross-framework compatibility)

2。.Net标准库将为您提供什么(跨框架兼容性)

Implementing a .Net Standard Library allows code sharing across all these different flavours:

实现。net标准库允许跨所有这些不同风格的代码共享:

.NET Core和。net标准类库项目类型的区别是什么?

For the impatient: TL;DR

耐心:TL,博士

  1. .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:
  2. .NET标准解决了。net开发人员在所有平台上的代码共享问题,它提供了所有您期望和喜欢的api,包括桌面应用程序、移动应用程序和游戏以及云服务:
  3. .NET Standard is a set of APIs that all .NET platforms have to implement. This unifies the .NET platforms and prevents future fragmentation.
  4. . net标准是所有。net平台都必须实现的一组api。这统一了。net平台,防止了将来的碎片化。
  5. .NET Standard 2.0 will be implemented by .NET Framework, .NET Core, and Xamarin. For .NET Core, this will add many of the existing APIs that have been requested.
  6. . net标准2.0将由。net Framework、。net Core和Xamarin实现。对于。net Core,这将添加许多已经被请求的现有api。
  7. .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.
  8. . net标准2.0包含了。net框架二进制文件的兼容性shim,显著增加了可以从。net标准库中引用的库集。
  9. .NET Standard will replace Portable Class Libraries (PCLs) as the tooling story for building multi-platform .NET libraries.
  10. . net标准将取代可移植类库作为构建多平台。net库的工具。

For a table to help understand what the highest version of .NET Standard that you can target, based on which .NET platforms you intend to run on, head over here.

对于一个表,可以帮助理解您可以针对的. net标准的最高版本,基于您想要运行的。net平台。

Sources: MSDN: Introducing .Net Standard

来源:MSDN:介绍。net标准

#3


55  

So the short answer would be:

简而言之,答案是:

IAnimal == .NetStandard (General)
ICat == .NetCore (Less General)
IDog == .NetFramework (Specific / oldest and has the most features)

#4


42  

.Net Framework and .Net Core are two different implementations of the .Net runtime. Both Core and Framework (but especially Framework) have different profiles that include larger or smaller (or just plain different) selections of the many APIs and assemblies Microsoft has created for .Net, depending on where they are installed and in what profile. For example, there are some different APIs available in Universal Windows apps than in the "normal" Windows profile. Even on Windows, you might have the "Client" profile vs the "Full" profile. Additionally, there are other implementations (like Mono) that have their own sets of libraries.

. net框架和. net核心是。net运行时的两个不同的实现。Core和Framework(尤其是Framework)都有不同的配置文件,其中包括Microsoft为. net创建的许多api和程序集的大或小(或仅仅是不同)选择,这取决于它们安装的位置和配置文件。例如,与“普通”Windows配置文件相比,通用Windows应用程序中有一些不同的api。甚至在Windows上,你可能有“客户”配置文件和“完整”配置文件。此外,还有其他具有自己的库集的实现(如Mono)。

.Net Standard is a specification for which sets of API libraries and assemblies must be available. An app written for .Net Standard 1.0 should be able to compile and run with any version of Framework, Core, Mono, etc, that advertises support for the .Net Standard 1.0 collection of libraries. Similar is true for .Net Standard 1.1, 1.5, 1.6, 2.0, etc. As long as the runtime provides support for that version of Standard, you can compile and run there.

. net标准是必须提供API库和程序集的规范。为。net标准1.0编写的应用程序应该能够编译并运行任何版本的框架、核心、Mono等等,这些都支持。net标准1.0库集合。对于。net标准1.1、1.5、1.6、2.0等等,同样适用。只要运行时提供了对标准版本的支持,您就可以在那里编译和运行。

A project targeted at a version of Standard will not be able to make use of features that are not included in that revision of the standard. This doesn't mean you can't take dependencies on other assemblies, or APIs published by other vendors (ie: items on NuGet). But it does mean that any dependencies you take must also include support for your version of .Net Standard. .Net Standard is evolving quickly, but it's still new enough, and cares enough about some of the smaller runtime profiles, that this limitation can feel stifling.

针对标准版本的项目将不能使用标准修订中没有包括的特性。这并不意味着您不能依赖于其他程序集或其他供应商发布的api(例如:NuGet上的项目)。但是,这确实意味着,任何依赖项都必须包括对。net标准版本的支持。

On the other hand, an app targeted at Standard should be able to be used in more deployment situations, since in theory it can run with Core, Framework, Mono, etc. For a class library project looking for wide distribution, that's an attractive promise. For a class library project used mainly for internal purposes, it may not be as much of a concern.

另一方面,针对Standard的应用程序应该能够在更多的部署情况下使用,因为理论上它可以使用Core、Framework、Mono等。对于一个类库项目来说,寻找广泛的发行,这是一个很有吸引力的前景。对于主要用于内部目的的类库项目,它可能不那么重要。

.Net Standard can also be useful in situations where the SysAdmin team is wanting to move from ASP.Net on Windows to ASP.Net for .Net Core on Linux for philosophical or cost reasons, but the Development team wants to continue working against .Net Framework in Visual Studio on Windows.

. net标准在SysAdmin团队希望从ASP迁移的情况下也很有用。Net在Windows上的ASP。Net在Linux上的核心是出于哲学或成本方面的原因,但是开发团队希望在Windows的Visual Studio中继续针对。Net框架进行工作。

#5


2  

.Net Standard exists mainly to improve code sharing and make the APIs available in each .Net implementation more consistent.

. net标准的存在主要是为了改进代码共享,使每个. net实现中的api更加一致。

While creating Libraries we can have target as.Net Standard 2.0 so that the library created would be compaitible with different versions of .Net Framework including .Net Core,Mono..

在创建库时,我们可以将目标设置为as。Net标准2.0,使所创建的库可以与不同版本的。Net框架(包括。Net Core,Mono)兼容。

#6


0  

.NET Standard: Think of it as a big standard library. When using this as a dependency you can only make libraries (.DLLs), not executables. A library made with .NET standard as a dependency can be added to a Xamarin.Android, a Xamarin.iOS, a .NET Core Windows/OSX/Linux project.

。net标准:把它看作一个大型的标准库。当使用它作为依赖项时,您只能创建库(. dll),而不是可执行的。使用. net标准作为依赖项的库可以添加到Xamarin中。Xamarin的Android。iOS,一个。net核心的Windows/OSX/Linux项目。

.NET Core: Think of it as the continuation of the old .NET framework, just it's opensource and some stuff is not yet implemented and others got deprecated. It extends the .NET standard with extra functions, but only runs on Desktops. When adding this as a dependency you can make runnable apps on Windows, Linux and OSX. (Although console only for now, no GUIs). So .NET Core = .NET Standard + Desktop specific stuff.
Also UWP uses it and the new ASP.NET core uses it as a dependency too.

. net Core:把它看作是旧的。net框架的延续,只是它是开源的,有些东西还没有实现,有些东西已经过时了。它用额外的功能扩展了。net标准,但只在桌面上运行。当将它作为一个依赖项添加时,您可以在Windows、Linux和OSX上创建可运行的应用程序。(虽然暂时只能控制台,没有gui)。net Core =。net标准+桌面特定的东西。UWP也使用它和新的ASP。NET core也将它用作一个依赖项。