.NET Core、.NET Framework 和 Xamarin 之间有什么区别? [英] What's the difference between .NET Core, .NET Framework, and Xamarin?

查看:45
本文介绍了.NET Core、.NET Framework 和 Xamarin 之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Microsoft 现在在其家族中拥有 .NET Core、.NET Framework 和 Xamarin (Mono).

Microsoft now has .NET Core, .NET Framework and Xamarin (Mono) in its family.

这里似乎有很多重叠.这些类型的 .NET 平台之间有什么区别?我什么时候应该在我的项目中选择使用 .NET Core,而不是 .NET Framework 或 Xamarin?

It seems to be a lot of overlap here. What's the difference between these types of .NET Platforms? When should I choose to use .NET Core in my project, instead of .NET Framework or Xamarin?

推荐答案

根据文档这里.

显然,如果您的目标是拥有一个能够跨平台(Windows、Linux 和 MacOS)运行的应用程序(网络/服务),那么 .NET 生态系统中的最佳选择是使用 .NET Core 作为其运行时 (CoreCLR) 和库是跨平台的.另一种选择是使用 Mono 项目.

1. Cross-Platform needs

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. The other choice is to use the Mono Project.

这两种选择都是开源的,但 .NET Core 是由微软直接和官方支持的,未来将有大量投资.

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 时,最好的开发体验存在于 Windows 上,Visual Studio IDE 支持许多生产力功能,包括项目管理、调试、源代码控制、重构、丰富的编辑(包括 Intellisense)、测试等等.但是在 Mac、Linux 和 Windows 上使用 Visual Studio Code 也支持丰富的开发,包括智能感知和调试.即使是 Sublime、Emacs、VI 等第三方编辑器也能很好地工作,并且可以使用开源 Omnisharp 项目获得编辑器智能感知.

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. But rich development is also supported using Visual Studio Code on Mac, Linux and Windows including intellisense and debugging. Even third party editors like Sublime, Emacs, VI and more work well and can get editor intellisense using the open source Omnisharp project.

当您正在构建由多个独立的、动态可扩展的、有状态或无状态的微服务组成的面向微服务的系统时,您在这里拥有的巨大优势是您可以在微服务级别使用不同的技术/框架/语言.这使您可以在系统中的每个微领域使用最佳方法和技术,因此如果您想构建非常高性能和可扩展的微服务,您应该使用 .NET Core.最终,如果您需要使用任何与 .NET Core 不兼容的 .NET Framework 库,那没有问题,您可以使用 .NET Framework 构建该微服务,将来您可能可以用 .NET 替代它核心.

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. 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.

您可以使用的基础设施平台有很多.理想情况下,对于大型复杂的微服务系统,应使用 Azure Service Fabric.但是对于无状态微服务,您还可以使用其他产品,例如 Azure 应用服务或 Azure 函数.

The infrastructure platform you could use are many. Ideally, for large and complex microservice systems, you should use Azure Service Fabric. But for stateless microservices you can also use other products like Azure App Service or Azure Functions.

请注意,截至 2016 年 6 月,并非 Azure 中的所有技术都支持 .NET Core,但随着 .NET Core 发布 RTM,Azure 中的 .NET Core 支持将急剧增加.

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.

当您的系统需要尽可能最佳的性能和可扩展性,以便无论您拥有多少用户都能获得最佳响应能力时,那么 .NET Core 和 ASP.NET Core 才是真正的亮点.在相同数量的基础设施/硬件上,您能做的越多,您的最终用户就能获得越丰富的体验——而且成本越低.

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. 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.

摩尔定律对单个 CPU 性能改进的日子不再适用;然而,您需要在系统增长的同时做更多的事情,并且需要更高的可扩展性和性能来满足每天数量呈指数增长的要求更高的用户.您最终需要提高效率,随处优化,并在机器、VM 和 CPU 内核的集群中更好地扩展.这不仅仅是用户满意的问题;它还可以在成本/TCO 上产生巨大的差异.这就是为什么努力提高性能和可扩展性很重要的原因.

The days of Moore’s law performance improvements for single CPUs does not apply anymore; 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. 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.

如前所述,如果您可以将系统的小部分隔离为微服务或任何其他松散耦合的方法,那就更好了,因为您不仅能够独立地发展每个小部分/微服务,而且可以拥有更好的长期敏捷性和维护,但如果您需要做的事情与 .NET Core 不兼容,您也可以在微服务级别使用任何其他技术.最终,您将能够重构它,并在可能的情况下将其引入 .NET Core.

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. And eventually you’d be able to refactor it and bring it to .NET Core when possible.

在使用 .NET Core 时,这种方法是可选的.当然,您也可以使用完整的 Visual Studio IDE.但是,如果您是想要使用轻量级编辑器和大量使用命令行进行开发的开发人员,那么 .NET Core 就是为 CLI 设计的.它提供了在所有支持的平台上可用的简单命令行工具,使开发人员能够在开发人员、实验室或生产机器上以最少的安装来构建和测试应用程序.像 Visual Studio Code 这样的编辑器使用相同的命令行工具来获得他们的开发体验.IDE 和 Visual Studio 一样使用相同的 CLI 工具,但将它们隐藏在丰富的 IDE 体验之后.开发人员现在可以选择他们想要与从 CLI 到编辑器再到 IDE 的工具链进行交互的级别.

This approach is optional when using .NET Core. You can also use the full Visual Studio IDE, of course. 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. 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. And IDE’s like Visual Studio use the same CLI tools but hide them behind a rich IDE experience. Developers can now choose the level they want to interact with the tool chain from CLI to editor to IDE.

如果您希望能够在 .NET 中安装依赖于不同版本框架的应用程序,您需要使用 .NET Core,它提供 100% 并行,如本文档前面所述.

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.

此外,您可能还想阅读:

In addition, you may also want to read:

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

这篇关于.NET Core、.NET Framework 和 Xamarin 之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆