·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设开发 >> ASP.NET网站开发 >> .NET Core 和 .NET Framework 之间的关系

.NET Core 和 .NET Framework 之间的关系

作者:佚名      ASP.NET网站开发编辑:admin      更新时间:2022-07-23

.NET Core 和 .NET Framework 之间的关系

引用一段描述:Understanding the relationship between .NET Core and the .NET Framework。

.NET Core and the .NET Framework have (for the most part) a subset-superset relationship. .NET Core is named "Core" since it contains the core features from the .NET Framework, for both the runtime and framework libraries. For example, .NET Core and the .NET Framework share the GC, the JIT and types such as String and List<T>. We'll continue imPRoving these components for both .NET Core and .NET Framework.

.NET Core was created so that .NET could be open source, cross platform and be used in more resource-constrained environments. We have also published a subset of the .NET Reference Source under the MIT license, so that you and the community can port additional .NET Framework features to .NET Core.


上面这两段话,最重要的是前面两句,.NET Core 和 .NET Framework 之间的关系,就是“subset-superset”,可以理解为子集的关系,.NET Framework 是一个大的概念,.NET Core 是从它里面分离出来的 Core(核心)部分,dudu 之前有个比喻:.NET Framework 是 Unix,.NET Core 是 linux,其实这个比喻总感觉不太恰当,这样比喻的观点是 .NET Core 是从 .NET Framework 演化而来,有点像父类-子类关系,而不是子集关系。

回答园友的几个问题:

1. .net framework 4.6 完全包括 .net core 5 吗?也就是说用 .net core 5 写的代码,能直接使用 .net framework 4.6 编译吗?

--完全包括(4.6 是 .NET Framework 版本号,并不是 .NET Framework 基础类库版本号),.NET Framework 是大的概念,编译是编译器做的工作,当然概念中包含编译器,也可以说可以编译。

2. 除了 aps.net 外,.net core 5 还包括了哪些 .net framework 4.6 中的特性?WF 包括吗?WCF 包括吗?windows form 和 wpf 应该不包括吧?

--现在的 .NET Core 可以理解为在 GitHub 中的:corefx 和 coreclr,Web Forms 不包含,WCF 只包含客户端,windows form 暂没看到,wpf 不支持。

3. 为什么 .net core 直接就到 5 了,而没有和 .net framework 用同样的版本号?

--.NET Core 和 .NET Framework 是子集关系,所以版本号是独立的。

参考:.NET Core与.NET Framework、Mono之间的关系