.NET Core,.NET Framework和Xamarin有什么区别?

本文翻译自:What's the difference between .NET Core, .NET Framework, and Xamarin?

Microsoft now has .NET Core, .NET Framework and Xamarin (Mono) in its .NET family. Microsoft现在在其.NET系列中具有.NET Core,.NET Framework和Xamarin(Mono)。

There seems to be a lot of overlap here. 这里似乎有很多重叠之处。 What's the difference between these types of .NET? 这些类型的.NET有什么区别? When should I choose to use .NET Core in my project, instead of .NET Framework or Xamarin? 什么时候应该选择在项目中使用.NET Core而不是.NET Framework或Xamarin?


#1楼

参考:https://stackoom.com/question/2Zi8r/NET-Core-NET-Framework和Xamarin有什么区别


#2楼

This is how Microsoft explains it: 微软是这样解释的:

.NET Framework,.NET Core,Xamarin

.NET Framework is the "full" or "traditional" flavor of .NET that's distributed with Windows. .NET Framework是随Windows分发的.NET的“完整”或“传统”风格。 Use this when you are building a desktop Windows or UWP app, or working with older ASP.NET 4.6+. 在构建桌面Windows或UWP应用或使用较旧的ASP.NET 4.6+时,请使用此功能。

.NET Core is cross-platform .NET that runs on Windows, Mac, and Linux. .NET Core是可在Windows,Mac和Linux上运行的跨平台.NET。 Use this when you want to build console or web apps that can run on any platform, including inside Docker containers. 当您要构建可在任何平台(包括Docker容器内部)上运行的控制台或Web应用程序时,请使用此选项。 This does not include UWP/desktop apps currently. 当前不包括UWP /桌面应用程序。

Xamarin is used for building mobile apps that can run on iOS, Android, or Windows Phone devices. Xamarin用于构建可在iOS,Android或Windows Phone设备上运行的移动应用程序。

Xamarin usually runs on top of Mono , which is a version of .NET that was built for cross-platform support before Microsoft decided to officially go cross-platform with .NET Core. Xamarin通常在Mono之上运行, Mono是.NET的一个版本,该版本是为跨平台支持而构建的,在Microsoft决定正式使用.NET Core跨平台之前。 Like Xamarin, the Unity platform also runs on top of Mono. 像Xamarin一样,Unity平台也可以在Mono之上运行。


A common point of confusion is where ASP.NET Core fits in. ASP.NET Core can run on top of either .NET Framework (Windows) or .NET Core (cross-platform), as detailed in this answer: Difference between ASP.NET Core (.NET Core) and ASP.NET Core (.NET Framework) 一个常见的混淆点是ASP.NET Core的适合位置。ASP.NETCore可以在.NET Framework(Windows)或.NET Core(跨平台)之上运行,如以下答案所述: ASP之间的区别。 NET Core(.NET Core)和ASP.NET Core(.NET Framework)


#3楼

You should use .NET Core, instead of .NET Framework or Xamarin, in the following 6 typical scenarios according to the documentation here . 根据此处的文档,在以下6种典型方案中,应使用.NET Core而不是.NET Framework或Xamarin。

1. Cross-Platform needs 1.跨平台需求

Clearly, if your goal is to have an application (web/service) that should be able to run across platforms (Windows, Linux and MacOS), the best choice in the .NET ecosystem is to use .NET Core as its runtime (CoreCLR) and libraries are cross-platform. 显然,如果您的目标是拥有一个应能够在各种平台(Windows,Linux和MacOS)上运行的应用程序(Web /服务),则.NET生态系统中的最佳选择是使用.NET Core作为其运行时(CoreCLR )和库是跨平台的。 The other choice is to use the Mono Project. 另一个选择是使用Mono项目。

Both choices are open source, but .NET Core is directly and officially supported by Microsoft and will have a heavy investment moving forward. 两种选择都是开放源代码,但是.NET Core受Microsoft直接和官方支持,并且将有大量投资向前发展。

When using .NET Core across platforms, the best development experience exists on Windows with the Visual Studio IDE which supports many productivity features including project management, debugging, source control, refactoring, rich editing including Intellisense, testing and much more. 在跨平台使用.NET Core时,Visual Studio IDE在Windows上拥有最佳的开发经验,该Visual Studio IDE支持许多生产力功能,包括项目管理,调试,源代码控制,重构,丰富的编辑(包括Intellisense),测试等等。 But rich development is also supported using Visual Studio Code on Mac, Linux and Windows including intellisense and debugging. 但是,在Mac,Linux和Windows上使用Visual Studio Code也支持丰富的开发,包括智能感知和调试。 Even third party editors like Sublime, Emacs, VI and more work well and can get editor intellisense using the open source Omnisharp project. 甚至Sublime,Emacs,VI等第三方编辑器也可以很好地工作,并且可以使用开源Omnisharp项目使编辑器具有智能感知能力。

2. Microservices 2.微服务

When you are building a microservices oriented system composed of multiple independent, dynamically scalable, stateful or stateless microservices, the great advantage that you have here is that you can use different technologies/frameworks/languages at a microservice level. 当您构建面向微服务的系统时,该系统将由多个独立的,可动态伸缩的,有状态的或无状态的微服务组成,您所拥有的最大优势是可以在微服务级别使用不同的技术/框架/语言。 That allows you to use the best approach and technology per micro areas in your system, so if you want to build very performant and scalable microservices, you should use .NET Core. 这样一来,您就可以在系统中的每个微区域中使用最佳方法和技术,因此,如果您要构建性能卓越且可扩展的微服务,则应使用.NET Core。 Eventually, if you need to use any .NET Framework library that is not compatible with .NET Core, there's no issue, you can build that microservice with the .NET Framework and in the future you might be able to substitute it with the .NET Core. 最终,如果您需要使用任何与.NET Core不兼容的.NET Framework库,都没有问题,您可以使用.NET Framework构建该微服务,并且将来您可以用.NET替代它。核心。

The infrastructure platform you could use are many. 您可以使用的基础架构平台很多。 Ideally, for large and complex microservice systems, you should use Azure Service Fabric. 理想情况下,对于大型和复杂的微服务系统,应使用Azure Service Fabric。 But for stateless microservices you can also use other products like Azure App Service or Azure Functions. 但是对于无状态微服务,您还可以使用其他产品,例如Azure App Service或Azure Functions。

Note that as of June 2016, not every technology within Azure supports the .NET Core, but .NET Core support in Azure will be increasing dramatically now that .NET Core is RTM released. 请注意,自2016年6月起,Azure中并非每种技术都支持.NET Core,但由于.NET Core已发布RTM,因此Azure中对.NET Core的支持将大大增加。

3. Best performant and scalable systems 3.最佳性能和可扩展系统

When your system needs the best possible performance and scalability so you get the best responsiveness no matter how many users you have, then is where .NET Core and ASP.NET Core really shine. 如果您的系统需要最佳的性能和可伸缩性,那么无论您有多少用户,您都将获得最佳的响应能力,那么.NET Core和ASP.NET Core真正发挥作用的地方。 The more you can do with the same amount of infrastructure/hardware, the richer the experience you'll have for your end users – at a lower cost. 使用相同数量的基础架构/硬件,您可以完成的工作越多,最终用户获得的体验就越丰富-成本更低。

The days of Moore's law performance improvements for single CPUs does not apply anymore; 摩尔定律提高单CPU性能的日子不再适用; yet you need to do more while your system is growing and need higher scalability and performance for everyday' s more demanding users which are growing exponentially in numbers. 但是,在系统不断发展的同时,您还需要做更多的工作,并且对于每天数量呈指数增长的日益苛刻的用户,还需要更高的可伸缩性和性能。 You need to get more efficient, optimize everywhere, and scale better across clusters of machines, VMs and CPU cores, ultimately. 最终,您需要提高效率,在各处进行优化并在计算机,VM和CPU内核的群集之间更好地扩展。 It is not just a matter of user's satisfaction; 这不仅仅是用户满意度的问题; it can also make a huge difference in cost/TCO. 这也会在成本/总拥有成本上产生巨大的差异。 This is why it is important to strive for performance and scalability. 这就是为什么追求性能和可伸缩性很重要的原因。

As mentioned, if you can isolate small pieces of your system as microservices or any other loosely-coupled approach, it'll be better as you'll be able to not just evolve each small piece/microservice independently and have a better long-term agility and maintenance, but also you'll be able to use any other technology at a microservice level if what you need to do is not compatible with .NET Core. 如前所述,如果您可以将系统的一小部分作为微服务或任何其他松散耦合的方法来隔离,那将是更好的选择,因为您不仅可以独立地发展每个小组件/微服务,而且可以拥有更好的长期服务敏捷性和维护性,但是如果您需要做的与.NET Core不兼容,您还可以在微服务级别使用任何其他技术。 And eventually you'd be able to refactor it and bring it to .NET Core when possible. 最终,您将能够对其进行重构,并在可能的情况下将其引入.NET Core。

4. Command line style development for Mac, Linux or Windows. 4. Mac,Linux或Windows的命令行样式开发。

This approach is optional when using .NET Core. 使用.NET Core时,此方法是可选的。 You can also use the full Visual Studio IDE, of course. 当然,您也可以使用完整的Visual Studio IDE。 But if you are a developer that wants to develop with lightweight editors and heavy use of command line, .NET Core is designed for CLI. 但是,如果您是想要使用轻量级编辑器并大量使用命令行进行开发的开发人员,则.NET Core专为CLI设计。 It provides simple command line tools available on all supported platforms, enabling developers to build and test applications with a minimal installation on developer, lab or production machines. 它提供了所有受支持平台上都可用的简单命令行工具,使开发人员可以在开发人员,实验室或生产机器上进行最少的安装即可构建和测试应用程序。 Editors like Visual Studio Code use the same command line tools for their development experiences. 像Visual Studio Code这样的编辑器使用相同的命令行工具来获得开发经验。 And IDE's like Visual Studio use the same CLI tools but hide them behind a rich IDE experience. 和像Visual Studio一样的IDE使用相同的CLI工具,但是将它们隐藏在丰富的IDE体验之后。 Developers can now choose the level they want to interact with the tool chain from CLI to editor to IDE. 开发人员现在可以选择他们想要与从CLI到编辑器再到IDE的工具链进行交互的级别。

5. Need side by side of .NET versions per application level. 5.每个应用程序级别并排需要.NET版本。

If you want to be able to install applications with dependencies on different versions of frameworks in .NET, you need to use .NET Core which provides 100% side-by side as explained previously in this document. 如果您希望能够安装依赖于.NET框架不同版本的应用程序,则需要使用.NET Core,它可以100%并排提供,如本文档前面所述。

6. Windows 10 UWP .NET apps. 6. Windows 10 UWP .NET应用程序。

In addition, you may also want to read: 此外,您可能还需要阅读:

  1. When should I NOT use .NET Core? 我什么时候应该使用.NET的核心?
  2. When should I still use .NET Framework 4.x, instead of .NET Core? 什么时候仍应使用.NET Framework 4.x而不是.NET Core?
  3. When should I use Xamarin, instead of .NET Core? 什么时候应该使用Xamarin而不是.NET Core?

#4楼

You can refer in this line - Difference between ASP.NET Core (.NET Core) and ASP.NET Core (.NET Framework) 您可以在此行中引用-ASP.NET Core(.NET Core)和ASP.NET Core(.NET Framework)之间的区别

.NET Framework,.NET Core,Xamarin

Xamarin is not a debate at all. Xamarin根本不是辩论。 When you want to build mobile (iOS, Android, and Windows Mobile) apps using C#, Xamarin is your only choice. 当您想使用C#构建移动(iOS,Android和Windows Mobile)应用程序时,Xamarin是您唯一的选择。

The .NET Framework supports Windows and Web applications. .NET Framework支持Windows和Web应用程序。 Today, you can use Windows Forms, WPF, and UWP to build Windows applications in .NET Framework. 今天,您可以使用Windows窗体,WPF和UWP在.NET Framework中构建Windows应用程序。 ASP.NET MVC is used to build Web applications in .NET Framework. ASP.NET MVC用于在.NET Framework中构建Web应用程序。

.NET Core is the new open-source and cross-platform framework to build applications for all operating system including Windows, Mac, and Linux. .NET Core是新的开源和跨平台框​​架,可为包括Windows,Mac和Linux在内的所有操作系统构建应用程序。 .NET Core supports UWP and ASP.NET Core only. .NET Core仅支持UWP和ASP.NET Core。 UWP is used to build Windows 10 targets Windows and mobile applications. UWP用于构建针对Windows和移动应用程序的Windows 10。 ASP.NET Core is used to build browser based web applications. ASP.NET Core用于构建基于浏览器的Web应用程序。

you want more details refer this links 您想要更多详细信息,请参考此链接
https://blogs.msdn.microsoft.com/dotnet/2016/07/15/net-core-roadmap/ https://docs.microsoft.com/en-us/dotnet/articles/standard/choosing-core-framework-server https://blogs.msdn.microsoft.com/dotnet/2016/07/15/net-core-roadmap/ https://docs.microsoft.com/zh-cn/dotnet/articles/standard/choosing-core-框架服务器


#5楼

.NET Core is the current version of .NET that you should be using right now (more features , fixed bugs , etc.) .NET Core是您现在应该使用的.NET的当前版本(更多功能,已修复的错误等)

Xamarin is a platform that provides solutions for cross platform mobile problems coded in C# , so that you don't need to use Swift separately for IOS and the same goes for Android. Xamarin是一个平台,为使用C#编码的跨平台移动问题提供了解决方案,因此您无需将Swift分别用于IOS和Android。


#6楼

  1. .NET is the Ecosystem based on c# language .NET是基于C#语言的生态系统
  2. .NET Standard is Standard (in other words, specification) of .NET Ecosystem . .NET标准.NET生态系统的标准(换句话说,规范)。

.Net Core Class Library is built upon the .Net Standard . .Net核心类库基于.Net标准构建。 .NET Standard you can make only class-library project that cannot be executed standalone and should be referenced by another .NET Core or .NET Framework executable project.If you want to implement a library that is portable to the .Net Framework , .Net Core and Xamarin , choose a .Net Standard Library .NET Standard您只能创建不能独立执行且应由另一个.NET Core或 .NET Framework可执行项目引用的类库项目。如果要实现可移植到.Net Framework的库,请使用.Net CoreXamarin ,选择.Net标准

  1. .NET Framework is a framework based on .NET and it supports Windows and Web applications .NET Framework是基于.NET的框架,它支持Windows和Web应用程序

(You can make executable project (like Console application, or ASP.NET application) with .NET Framework (您可以使用.NET Framework创建可执行项目(例如控制台应用程序或ASP.NET应用程序)

  1. ASP.NET is a web application development technology which is built over the .NET Framework ASP.NET是基于.NET Framework构建的Web应用程序开发技术
  2. .NET Core also a framework based on .NET . .NET Core也是基于.NET的框架。

It is the new open-source and cross-platform framework to build applications for all operating system including Windows, Mac, and Linux. 它是新的开源和跨平台框​​架,可为所有操作系统(包括Windows,Mac和Linux)构建应用程序。

  1. Xamarin is a framework to develop a cross platform mobile application( iOS, Android, and Windows Mobile ) using C# Xamarin是使用C#开发跨平台移动应用程序( iOS,Android和Windows Mobile )的框架

Implementation support of .NET Standard[blue] and minimum viable platform for full support of .NET Standard (latest: [ https://docs.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support] ) .NET Standard [blue]的实施支持和对.NET Standard的全面支持的最小可行平台(最新:[ https://docs.microsoft.com/zh-cn/dotnet/standard/net-standard#net-implementation-支持]

猜你喜欢

转载自blog.csdn.net/p15097962069/article/details/107661289