微软现在拥有。net Core、。net Framework和Xamarin (Mono)。
这里似乎有很多重叠。这些类型的。net平台有什么不同?什么时候我应该选择在我的项目中使用。net Core,而不是。net Framework或Xamarin?
微软现在拥有。net Core、。net Framework和Xamarin (Mono)。
这里似乎有很多重叠。这些类型的。net平台有什么不同?什么时候我应该选择在我的项目中使用。net Core,而不是。net Framework或Xamarin?
当前回答
. net Framework(最新版本4.8)只支持windows平台。意味着您的桌面应用程序只能在Windows上工作。web应用程序只能托管在Windows Server/Windows操作系统上 .Net Core(从。net Core 1, 2, 2.1, 3.1,最新版本5开始)是交叉的 平台。(windows, Linux, Mac)。 另一方面,Xamarin支持移动平台。(Android和IOS)。用于开发移动应用程序。
其他回答
. net Core是你现在应该使用的。net的当前版本(更多的特性,修复的bug,等等)
Xamarin是一个提供用c#编写的跨平台移动问题解决方案的平台,所以你不需要在IOS和Android上单独使用Swift。
微软是这样解释的:
. net Framework是随Windows发布的。net的“完整”或“传统”版本。当您正在构建桌面Windows或UWP应用程序,或使用旧的ASP。NET 4.6 +。
. net Core是跨平台的。net,可以在Windows、Mac和Linux上运行。当你想要构建可以在任何平台上运行的控制台或web应用程序时,包括在Docker容器中。目前还不包括UWP/桌面应用程序。
Xamarin用于构建可在iOS、Android或Windows Phone设备上运行的移动应用程序。
Xamarin通常运行在Mono之上,Mono是。net的一个版本,在微软决定正式使用。net Core跨平台之前,它是为跨平台支持而构建的。net。与Xamarin一样,Unity平台也运行在Mono之上。
一个常见的混淆点是ASP。NET Core很适合。ASP。NET Core可以运行在。NET Framework (Windows)或。NET Core(跨平台)之上,详见下文。NET Core(。NET Core)和ASP。NET Core(。净框架)
你应该使用。net Core,而不是。net Framework或Xamarin,根据这里的文档,在以下6个典型场景中。
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. Both choices are open source, but .NET Core is directly and officially supported by Microsoft and will have a heavy investment moving forward. 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. 2. Microservices 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. 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. 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. 3. Best performant and scalable systems 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. 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. 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. 4. Command line style development for Mac, Linux or Windows. 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. 5. Need side by side of .NET versions per application level. 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. 6. Windows 10 UWP .NET apps.
此外,你可能还想阅读:
什么时候不应该使用。net Core? 什么时候我应该继续使用。net Framework 4。x,而不是。net Core? 什么时候我应该使用Xamarin,而不是。net Core?
[截至2022年2月]
net框架
专有的框架 主要适用于Windows操作系统 4.8版本是它的最终版本。 对它的支持可能会在Windows 10(以及它的其他兄弟服务器)结束
.NET(以前的。net Core)
免费开源 跨平台的 .NET框架的继承者 目前。net 6是LTS版本
Xamarin的
免费开源 用于使用。net和c#构建Android和iOS应用程序 .NET的一部分
.NET是基于c#语言的生态系统 . net标准是. net生态系统的标准(换句话说,规范)。
. net核心类库是建立在. net标准之上的。 . net标准你只能创建不能独立执行的类库项目,并且应该被其他。net Core或。net Framework可执行项目引用。如果你想实现一个可移植到。net Framework、。net Core和Xamarin的库,选择一个。net标准库
.NET Framework是一个基于。net的框架,支持Windows和Web应用程序
(你可以使可执行项目(如控制台应用程序,或ASP。NET应用程序)使用。NET框架
ASP。NET是一种基于。NET框架的web应用开发技术 . net Core也是一个基于。net的框架。
它是一个新的开源和跨平台框架,可以为包括Windows、Mac和Linux在内的所有操作系统构建应用程序。
Xamarin是一个使用c#开发跨平台移动应用程序(iOS、Android和Windows mobile)的框架
.NET标准的实现支持[蓝色]和完全支持。net标准的最小可行平台(最新:[https://learn.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support])