英文:
Confusion About .Net vs .Net Core vs .Net Standard vs .Net Framework
问题
我对.NET领域还不太了解。
关于所有这些,我真的感到很困惑,我无法弄清楚。我搜索了很多,但找不到任何关于.NET的简单明了的解释(还包括标题中提到的各种不同版本的名称)。
所以我的问题是,为什么会有不同的.NET名称(就像我在标题中写的那样)。哪一个适用于谁?
英文:
I'm kind of new to .NET area.
There is big confusion about all these which I really couldn't figure out. I searched a lot but couldn't find any simple and straight forward explanation for .NET (also by mean all other different names of versions like in title as well)
So my question is why are there different names of .NET(as I wrote in the title). Which one is for who?
答案1
得分: 3
以下是.NET Standard的简化说明,包括不同名称和版本的.NET:
.NET Standard: 这是一个规范,定义了一组通用的API,可以被.NET应用程序使用。这使得编写可以在不同的.NET平台上运行的代码成为可能,如.NET Framework、.NET Core以及.NET 5及更高版本。
.NET Framework: 这是.NET平台的最初版本,主要用于构建Windows桌面和Web应用程序。它仍然得到支持,但被视为传统技术。
.NET Core: 这是.NET的跨平台版本,旨在克服.NET Framework的一些限制。它轻量、快速,并适用于构建可以在Windows、macOS和Linux上运行的跨平台应用程序。.NET Core是新项目的推荐选择。
.NET 5及更高版本 微软决定简化命名并将.NET Core和.NET Framework合并为一个称为.NET 5的单一平台。这个新平台得到全面支持,是新项目的推荐选择。
总之,如果您要启动一个新项目,应该使用最新版本的.NET Standard,比如.NET Standard 2.1或更高版本。这将为您提供最现代化的功能和改进,并使您的应用程序更具跨平台性。
英文:
Here is the simplified explanation of .NET Standard, including the different names and versions of .NET:
.NET Standard: This is a specification that defines a common set of APIs that can be used by .NET applications. This makes it possible to write code that can run on different .NET platforms, such as .NET Framework, .NET Core, and .NET 5 and beyond.
.NET Framework: This is the original version of the .NET platform, which is mostly used for building Windows desktops and web applications. It is still supported, but it is considered a legacy technology.
.NET Core: This is a cross-platform version of .NET that was introduced to overcome some limitations of the .NET Framework. It is lightweight, fast, and suitable for building cross-platform applications that can run on Windows, macOS, and Linux. .NET Core is the recommended choice for new projects.
.NET 5 and beyond Microsoft decided to simplify the naming and converge .NET Core and .NET Framework into a single platform called .NET 5. This new platform is fully supported and is the recommended choice for new projects.
In summary, if you are starting a new project, you should use the latest version of .NET Standard, such as .NET Standard 2.1 or later. This will give you the most modern features and improvements, and it will also make your application more cross-platform.
答案2
得分: 2
.NET是一组跨语言的编译器和工具,由一组底层运行时库支持。C#是主要的.NET语言,但VB.NET和F#也是.NET语言之一。
.NET Framework仅适用于Windows。最终版本(v4.8.x)不再积极开发,但这并不意味着它不会获得安全更新,它将得到支持,只要Windows 11得到支持(可能还有更高版本的操作系统)。
https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-framework
.NET Core支持多种操作系统,包括Windows、Linux、macOS、iOS、Android OS等。它是从头开始完全重写的,尽管与.NET Framework具有很大的兼容性,但在许多方面都非常不同。
https://dotnet.microsoft.com/en-us/learn/dotnet/what-is-dotnet
.NET 5及更高版本只是.NET Core的5及以上版本。之所以选择5,是因为它比.NET Core 3和.NET Framework 4.8都要高。(没有.NET Core 4.X)
.NET Standard是一个中间库,允许代码在.NET Framework和.NET Core之间共享。理论上,如果将代码编译为.NET标准,它应该与Framework和Core兼容。
如果您正在寻找关于为哪个版本的.NET编写代码的建议(实际上不允许在这里提问),通常会选择.NET Core,除非您需要.NET Framework中的众多仅适用于Windows的API(尽管诸如WCF之类的东西现在也支持.NET Core)。
英文:
.NET is a cross language set of compilers and tools that are supported by an underlying set of runtime libraries. C# is the major .NET language, but also VB.NET and F# are also .NET languages.
.NET Framework is Windows only. The final version (v4.8.x) it is not actively being developed, but that doesn't mean it won't get security updates and it will be supported for as long as Window 11 is supported (and may be later OSs).
https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-framework
.NET Core is supported on multiple operating systems (including Windows, Linux, macOs, IOS, Android OS and others). It was completely rewritten from scratch and although it shares a large compatibility with .NET framework, it is very different in many places.
https://dotnet.microsoft.com/en-us/learn/dotnet/what-is-dotnet
.NET 5 and above is just .NET core version 5 and above. 5 was chosen to be higher than both .NET core 3, and .NET framework 4.8. (there was no .NET core 4.X)
.NET Standard is an in-between library that allows code to be shared between .NET Framework and .NET Core. In theory, if you compile code to .NET standard, it should be compatible with Framework and Core.
If you are looking for advice for which version of .NET to write code for (not really allowed on SO), it would generally be .NET core, unless you require one of the many Windows only APIs that are only available in .NET Framwork (although things like WCF is now on .NET core).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论