ChatGPT解决这个技术问题 Extra ChatGPT

What's the difference between .NET Core, .NET Framework, and Xamarin?

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

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?

The missing tag is microsoft, but that does not exist. This question assumes Microsoft. Today you also have to chose between: for desktop gui apps: e.g. java. For mobile: native android / objective-C, or one of many other cross-platform frameworks. For web: e.g. flask. As the answer mentioning .Net5 shows, Microsoft is desperately trying to get a foothold on other platforms than MS-Windows and feels the competition of open-source Mono, but has not found a stable solution yet.
.net Framework - windows specific framework (old windows forms exists here); .net core - cross platform (new razor pages exists here); Xamarin - mobile framework (xamarin.android, xamarin.ios, and xamarin.forms) based on .net and c# to develop mobile apps. If you are doing web application go with .net core as it is the latest and promoted one. In future, there will be no .net core or .net framework or xamarin but only ".Net"

C
Community

You should use .NET Core, instead of .NET Framework or Xamarin, in the following 6 typical scenarios according to the documentation here.

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.

In addition, you may also want to read:

When should I NOT use .NET Core? When should I still use .NET Framework 4.x, instead of .NET Core? When should I use Xamarin, instead of .NET Core?


Why asp.net Core is more performant? Why is better when you are building microservices?
Now Visual Studio for Mac is also available. So one more positive point towards .NET Core. visualstudio.com/vs/visual-studio-mac
Your links are broken
@JuanZamudio Versions of the framework are monolithic layers, each dependent on the immediately prior version, in a dependency chain back to version 2.0 which wholly replaced 1.1. As a result, if you use anything from 4.5 you implicitly depend on everything ever right back to 2.0. The Core framework is more about refactoring dependencies to eliminate irrelevant baggage than rewriting the API, which is mostly but not entirely unchanged. Some things also got massively simplified, like EF Core.
They differ only in one thing: MS will drop Core in nearest 5 years. While programmer still use .NET FW 4.8 and WinForms/WPF.
N
Nate Barbettini

This is how Microsoft explains it:

https://i.stack.imgur.com/sw8Ln.png

.NET Framework is the "full" or "traditional" flavor of .NET that's distributed with Windows. Use this when you are building a desktop Windows or UWP app, or working with older ASP.NET 4.6+.

.NET Core is cross-platform .NET that runs on Windows, Mac, and Linux. Use this when you want to build console or web apps that can run on any platform, including inside Docker containers. This does not include UWP/desktop apps currently.

Xamarin is used for building mobile apps that can run on iOS, Android, or Windows Phone devices.

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. Like Xamarin, the Unity platform also runs on top of 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)


Whenever someone says .NET Core is cross-platform, a new developer gets confused. '.NET Core' supports UWP + ASP.NET Core only & ASP.NET Core is cross-platform, UWP is not.
@HassanTareq That's not quite correct. .NET Core refers to the runtime and libraries that can run on Windows, Mac, or Linux. ASP.NET Core is cross-platform because .NET Core is cross-platform.
Then it would be helpful for greenhorns if you mention that Although .Net core (run-time and libraries) is cross platform, we can not use UWP app in Mac/Linux. UWP is not cross-platform, I expected UWP to be cross-platform alternative of WPF (Xamarin.Forms is)
@HassanTareq Good suggestion, I've edited my answer.
Xamarin Forms now runs on nearly everything from one code base. Windows UWP desktop, WPF desktop, MacOS, iOS, Android, and Tizen (TVs). The default is to target .NET Standard from the Core implementation. Good times!
l
logeshpalani31

You can refer in this line - Difference between ASP.NET Core (.NET Core) and ASP.NET Core (.NET Framework)

https://i.stack.imgur.com/CtALu.jpg

Xamarin is not a debate at all. When you want to build mobile (iOS, Android, and Windows Mobile) apps using C#, Xamarin is your only choice.

The .NET Framework supports Windows and Web applications. Today, you can use Windows Forms, WPF, and UWP to build Windows applications in .NET Framework. ASP.NET MVC is used to build Web applications in .NET Framework.

.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 supports UWP and ASP.NET Core only. UWP is used to build Windows 10 targets Windows and mobile applications. ASP.NET Core is used to build browser based web applications.

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


The third box should be "Mono", which is another implementation of the .Net Standard. Xamarin is not, it's just a cross-platform library which runs on top of Mono (or used to??). To make things more confusing, Xamarin (the company) bought Mono (the company), and both were later bought by Microsoft.
P
Patman

.NET is the Ecosystem based on c# language .NET Standard is Standard (in other words, specification) of .NET Ecosystem .

.Net Core Class Library is built upon the .Net Standard. .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 Framework is a framework based on .NET and it supports Windows and Web applications

(You can make executable project (like Console application, or ASP.NET application) with .NET Framework

ASP.NET is a web application development technology which is built over the .NET Framework .NET Core also a framework based on .NET.

It is the new open-source and cross-platform framework to build applications for all operating system including Windows, Mac, and Linux.

Xamarin is a framework to develop a cross platform mobile application(iOS, Android, and Windows Mobile) using C#

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])


y
yanlend

https://i.stack.imgur.com/zr2oy.png


It's a lie. .NET Core cannot support WPF/WinForms on Linux!
That's true, but other variants of .NET did not support that either. The choice for a variant of .NET is gone, which is a good thing.
J
J. Doe

.NET Framework - Windows only legacy implementation by Microsoft of .NET. Introduced in 2002, being phased out.

.NET 5 (successor to .NET Core 3.1) - modern reimplementation of .NET Framework aimed at replacing it, supports Windows, macOS and Linux. Introduced in 2016, further version might absorb Xamarin

Xamarin - Mono with platform bindings to non-windows OS's and APIs and tools tailored to mobile app development (iOS, Android and recently desktop). Introduced in 2012. Mono is a non Microsoft implementation of .NET developed by community and introduced in early 2000s and competing with .NET Framework.


M
Marto99

.NET Core is the current version of .NET that you should be using right now (more features , fixed bugs , etc.)

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.


I would say .Net Core is what you should be using if you must run on Linux or Linux and Windows. But you could make that case for Mono as well, I think. It certainly does not have more features. By definition it is only the "core" bits, it has none of the Windows-only bits, hence, fewer features. And I am just guessing but it seems unlikely that .Net Core has fewer bugs. The .Net Framework has been out in the world for almost two decades. I would imagine it is pretty battle-hardened at this point. But that is just a guess.
It certainly has more new features, they recently added new classes that will not be added to .NET 4.8. They also ported WPF and WinForms. Actually it looks like .NET Core could replace .NET Framework. It seems to be more performant either.
S
ShivCK

[As of February 2022]

.NET Framework

Proprietary framework

Primarily for Windows OS

Version 4.8 was its final version.

Support for it will probably end with that of Windows 10 (and it's other server siblings )

.NET (previously .NET Core)

Free and open-source

Cross-platform

Successor to .NET Framework

Currently .NET 6 is the LTS version

Xamarin

Free and open-source

For building Android and iOS apps with .NET and C#

Part of .NET


u
user10868910

Xamarin is used for phone applications (both IOS/Android). The .NET Core is used for designing Web applications that can work on both Apache and IIS.

That is the difference in two sentences.


Hmm.. well aside from missing the 3rd option (.net framework) it's not entirely true. .NET core can be used on pretty much everything (Web, Desktop, Mobile, Cloud, Gaming, IoT etc). .NET Framework is windows centric and was entirely closed. Mono was the open source (community driven) version of .NET Framework used by Xamarin which put cross platform mobile tooling on top of mono. Xamarin will eventually be replaced, most likely by Blazor (currently pwa, but hybrid then native are part of the road map).
It is true. Xamarin is for mobile applications. I don't think it will be replaced soon. ASMX is still used for Web Services, and included in Visual 2019.
J
Jubish Kammily

.Net Framework (latest version 4.8) supports only windows platform.Means your desktop application will work only on Windows. And web application can only be hosted on Windows Server/Windows OS .Net Core (starting from .net core 1, 2 , 2.1 , 3.1 , Latest version 5) are cross platform.(windows , Linux , Mac). Xamarin on the other hand supports Mobile Platform. (Android and IOS).For developing mobile apps.


S
Saddam Akhtar

.Net Frame work is used for windows base Applications. .Net Core Frame work is used for Cross Platform base Applications. Xamarin Frame work is used for Mobile's Applications Development.