简体   繁体   English

.NET Framework、.NET Standard、.NET Core 和 .NET 之间的差异 5

[英]Difference between .NET Framework, .NET Standard, .NET Core and .NET 5

I built a C# application, my target framework was .NET Framework 4.72.我构建了一个 C# 应用程序,我的目标框架是 .NET Framework 4.72。 While I used TDengine C# connector , and its target framework is .NET Standard 2.1 and .NET 5.当我使用TDengine C# 连接器时,它的目标框架是 .NET Standard 2.1 和 .NET 5。

While I reference these package in the project, I always get an error while building, which said that the method marshal.当我在项目中引用这些 package 时,我在构建时总是出错,它说方法 marshal.

Marshal.StringToCoTaskMemUTF8(String) Marshal.StringToCoTaskMemUTF8(字符串)

was not in Framework 4.7.2.不在 Framework 4.7.2 中。

I am confused, since in my opinion 4.7.2 should be a lower version than .NET 5. And this should be compatible.我很困惑,因为在我看来 4.7.2 应该是低于 .NET 5 的版本。这应该是兼容的。

So what is the difference between .NET Standard vs .NET Framework .NET 5, 6, 7. These name always confusing me.那么 .NET Standard 与 .NET Framework .NET 5、6、7 之间有什么区别。这些名称总是让我感到困惑。 Does any know how to distinguish them or suggest some article to help me know them.有谁知道如何区分它们或推荐一些文章来帮助我了解它们。

As it is indeed confusing, I tried to figure it out myself lately.因为它确实令人困惑,所以我最近试图自己弄清楚。 Here is what I came up with:这是我想出的:

.NET and .NET Core are successors of .NET Framework . .NET 和 .NET Core.NET Framework的继承者。

Since Version 5, .NET Core is only called .NET:从 Version 5 开始,.NET Core 只被称为 .NET:

  • .NET Core 1.0 .NET 核心1.0
  • .NET Core 1.1 .NET 核心1.1
  • .NET Core 2.0 .NET 核心2.0
  • .NET Core 2.1 .NET 核心2.1
  • .NET Core 2.2 .NET 核心2.2
  • .NET Core 3.0 .NET 核心3.0
  • .NET Core 3.1 .NET 核心3.1
  • .NET 5 .NET 5
  • .NET 6 .NET 6
  • .NET 7 .NET 7
  • .NET 8 .NET 8

.NET Framework runs from Version 1.0 to 4.8 and the Version numbers can't be compared with those of .NET Core or .NET respectively. .NET Framework从1.0版本运行到4.8版本,版本号无法分别与.NET Core或.NET进行比较。

.NET Standard is not a framework or platform itself. .NET 标准本身不是框架或平台。 It just sets specifications (standards) for the .NET implementations to be ".NET Standard compliant".它只是将 .NET 实现的规范(标准)设置为“.NET 标准兼容”。 Here you can see a list of the different .NET Standard versions and the .NET implementations and versions they support. 在这里,您可以看到不同的 .NET 标准版本及其支持的 .NET 实现和版本的列表。

Yeah this is very confusing!是的,这很令人困惑!

.NET Core was a rewrite of the .NET Framework in order to make it platform-independent. .NET 核心是对 .NET 框架的重写,以使其与平台无关。 It has a number of incompatibilities with the classic .NET Framework (.NET up until version 4.8).它与经典的 .NET 框架(.NET 4.8 之前的版本)有许多不兼容之处。 Newer versions of .NET from version 5 and forward are based on the Core fork, so are not fully compatible with the older version up until 4.8. .NET 版本 5 及以后的新版本基于 Core 分支,因此直到 4.8 才与旧版本完全兼容。

.NET Standard was an attempt to create a common subset that was compatible across all versions. .NET Standard 试图创建一个在所有版本之间兼容的通用子集。 So if you programmed against .NET Standard, you code would work both with the 4.8 branch and the Core branch.因此,如果您针对 .NET 标准进行编程,您的代码将同时适用于 4.8 分支和核心分支。 Unfortunately, MS botched this by making a version of .NET Standard which wasn't compatible with .NET 4.8.不幸的是,微软通过制作一个与 .NET 4.8兼容的标准版本 .NET 来搞砸了。 They probably did this out of spite towards .NET developers.他们这样做可能是出于对 .NET 开发人员的恶意。

Major .NET framework versions:主要 .NET 框架版本:

.NET Framework 1.0 -> .NET Framework 2.0 -> .NET Framework 3.0 -> .NET Framework 3.5 -> .NET Framework 4.0 -> .NET Framework 4.8 .NET 框架 1.0 -> .NET 框架 2.0 -> .NET 框架 3.0 -> .NET 框架 3.5 -> .NET 框架 4.0 -> .NET 框架 4.8

Major .NET Core versions:主要 .NET 核心版本:

.NET Core 1 -> .NET core 2 -> .NET Core 3 -> .NET 5 -> .NET 6 .NET 核心 1 -> .NET 核心 2 -> .NET 核心 3 -> .NET 5 -> .NET 6

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM