.NET: Framework, Core and Standard

【Note】This article was written and finished before or on July 2, 2022. I found it in my internal library. I do not remember why it has not been published yet. The best reason is that at the time I wrote the article, I had a task using .NET Standard, I might plan to add that sample code into this article, but without the chance to do it. I read this article. It seems a complete one and an independent one. So, I will publish this article with a possible topic title, in case I can make it written.

So, this series of articles will be.

A - Introduction

In this article, we are going to explore about differences between the .NET Framework, .NET Core, and .NET Standard.

The content of this article:

  • A - Introduction
  • B - .NET Framework vs .NET Core
  • C - .NET Standard
  • D - Summary

B - .NET Framework vs .NET Core
 

  .NET Framework .NET Core
History The .NET Framework is the first implementation of .NET. .NET Core is the latest implementation of .NET.
Open Source Certain components of the .NET Framework are open source. .NET Core is open-source.
Cross-Platform It works only on the Windows platform. This does not support cross-platform deployment. It runs cross-platform like Windows, Linux, and macOS.
Third-party packages Support There are many third-party packages and libraries available. The .NET Core also has support for a large number of third-party packages, but still, it doesn’t compete with .NET Framework.
In-app deployment It doesn’t support the in-app deployment model. It does support an in-app deployment model.
Performance and Scalability .NET Framework is less effective in comparison to .NET Core in terms of performance and scalability of applications. .NET Core offers high performance and scalability compared to .NET Framework.
Micro-Services Implementation .NET Framework does not support the implementation of micro-services. .NET Core supports the implementation of micro-services
REST Services Implementation It supports the REST API services implementation. We can create a REST API using .NET Core.
Command-line Tools .NET Core provides lightweight editors and command-line tools for all supported platforms. .NET Framework is heavy for Command Line Interface
When to use
  • Our application runs on only the Windows platform.
  • Our application is based on WinForms or WPF applications.
  • ASP.NET Web Forms creation.
  • If you want to create a WCF service.
  • Our application uses some third-party packages which are not supported by .NET Core.
  • The application uses .NET technologies that are not available for .NET Core.
  • If your application wants to access Windows-specific APIs, then choose .NET Framework.
  • To create cross-platform applications.
  • To create Microservices, then definitely go with .NET Core.
  • To deploy an application to Dockers containers.
  • To create high-performance and scalable applications.
  • If you are running multiple .NET versions side-by-side, choose .NET Core.
  • If you want a command line interface (CLI) control, then .NET core is the best option.
When not to use
  • When running across OS platforms is a requirement for your application.
  • If you want to implement the microservices.
  • Web applications that require the best possible performance and scalability
  • ASP.NET WebForms don’t exist in .NET Core.
  • If you want to create a WCF service.
  • If your application wants to access Windows-specific APIs.
  • If your application needs to work with the Windows Registry, WMI, or other Windows-specific APIs, then it won’t work with .NET Core.


C - .NET Standard

Let's consider we have created an application using .NET Framework and some shared libraries (which are developed by .NET Framework). After some time, we decided to create an application in .NET Core and try to re-use the above-shared library. Is it compatible, and can we use it? The answer is NO. We cannot use the .NET Framework Base Class Library in .NET Core applications because of compatibility issues. Basically, the libraries that target the .NET Framework can only run in .NET Framework-based applications and the libraries which target to .NET Core can only run in .NET Core-compatible applications.

What is the solution?

The solution is .NET Standard. .NET Standard is a specification of the set of APIs that is compatible with any .NET platform (which is either .NET Framework or .NET Core). If we create the Base Class Library using .NET Standard, then it will run with any .NET Runtimes. So, if you want to create a shared library that is going to be re-used later, then you choose .NET Standard because it is portable with .NET Framework, .NET Core, and Xamarin as well.

Each .NET Standard version contains some set of APIs like System.Data, System.Collections Etc. If a new version of the .NET Standard is introduced, then it contains all the previous version sets of APIs as well as some of the new APIs. A higher version of the .NET Standard means more APIs available.

.NET Standard

  • It is not a framework like .NET Framework or .NET Core.
  • This is the set of fundamental APIs that all .NET implementations must implement
  • Use for code sharing and reuse the codes between different runtimes.
  • Compatible with any .NET application.

.NET Standard supports a wide range of frameworks, which are listed in the below table.

https://docs.microsoft.com/en-us/dotnet/standard/net-standard

.NET Standard 1.0 1.1 1.2 1.3 1.4 1.5 1.6 2.0 2.1
.NET 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0
.NET Core 1.0 1.0 1.0 1.0 1.0 1.0 1.0 2.0 3.0
.NET Framework 1 4.5 4.5 4.5.1 4.6 4.6.1 4.6.1 2 4.6.1 2 4.6.1 2 N/A3
Mono 4.6 4.6 4.6 4.6 4.6 4.6 4.6 5.4 6.4
Xamarin.iOS 10.0 10.0 10.0 10.0 10.0 10.0 10.0 10.14 12.16
Xamarin.Mac 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.8 5.16
Xamarin.Android 7.0 7.0 7.0 7.0 7.0 7.0 7.0 8.0 10.0
Universal Windows Platform 10.0 10.0 10.0 10.0 10.0 10.0.16299 10.0.16299 10.0.16299 TBD
Unity 2018.1 2018.1 2018.1 2018.1 2018.1 2018.1 2018.1 2018.1 2021.2.0b6


D - Summary

  • .NET Framework is mainly used for Windows-based application development, which is less effective in comparison to .NET Core.
  • .NET Core is open-source and used to develop cross-platform applications and micro-services.
  • .NET Standard is used to create a shared library that can be re-used in any .NET platform.

I hope you have liked it and know about the differences between .NET Framework, .NET Core, and .NET Standard.

Reference