.Net Framework and .Net Core both are two different implementations of .Net Runtime. First one is older and .Net Core is newer than .Net Framework. Today, we will understand the difference between and .Net Framework and .Net Core and how these both are different from .Net Standard and why we should use .Net Standard.
.Net Framework is a framework for building and managing the Windows and Web-based application. This is old framework created by Microsoft and provides end to end solution to create Windows application generally known as Win Forms and Web Application like Asp.Net or Asp.Net MVC application.
What we can do with .Net Framework.
- Create a Windows Application.
- Create Web Forms using Asp.Net, Rest API using Web API and enterprise application using Asp.Net MVC
- Can use multiple languages, that’s why it is language independent.
- Create an app with good performance.
.Net Core is a cross-platform and open source framework for building the application which can run on any platform. It is also created by Microsoft. It is not a new version on .Net Framework, whereas it is a totally new framework which is written from scratch to develop an application which can run on any platforms like Mac, Linux or Windows. Earlier .Net Framework was Language Independent but .Net Core is language independent as well as platforms independent.
What we can do with .Net Core.
- Create cross platforms application.
- Can use Microservices
- Deploy an application to Dockers container.
- Create highly scalable and performable system.
- Create Asp.Net Core, Razor page, UMP, Mobile native app and Blazor application.
Before understanding the .Net Standard, let first understand the architecture of .Net Framework and .Net Core. We need to first understand what problem we face to that we need to use .Net Standard. While working with either .Net Framework or .Net Core or Xamarin application, you required Base Class Library (BCL) that is used for sharing the code between multiple projects or solution.
As per the above image, we can see that each one has its own BCL (Base Class Library).
What is the Problem?
Example: Let assume we create an application using .Net Framework and use its library for shared code. After some time, we feel to create an application in .Net Core and try to re-use the same shared code library which is created in .Net Framework.
Can we do that? The answer is NO. We cannot use .Net Framework Base Class Library in .Net Core because of compatibility issues. Basically, the libraries which target to .Net Framework can only run in .Net Framework based application 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 which is compatible for any .Net platforms either it is .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 are willing to create an application and keep your shared code into Base Class Library then you should choose .Net Standard, because it is portable with .Net Framework, .Net Core and Xamarin as well. If in short, we say something about .Net Standard, so it will be as follows.
- It is an evolution of Portable Class Library and completely replaced to PCL.
- It is not a framework like .Net Framework or .Net Core.
- It is the specification that needs to be implemented by .Net Framework or .Net Core.
- Use for code sharing and reuse the codes between different runtimes.
- Compatible with any .Net application.
AS per the above image, you can see that instead of keeping a different-different class library for each framework, we can keep only one as .Net Standard which rules them to all.
How .Net Standard is backward compatible?
Actually each .Net Standard version contains some set of APIs like System.Data, System.Collections etc. If a new version of .Net Standard gets introduced then it contains all the previous version set of APIs as well as some of new APIs. So, it means a newer version of .Net Standard contains all the set of APIs from beginning to end which means a higher version of .Net Standard means more APIs availability.
If you see the compatibility with another framework, then you will find that .Net Standard supports a wide range of Framework. You can refer the following link for updated framework supports.
So, today we have understood the actual difference between .Net Framework and .Net Core and how .Net Standard is different from this two..
I hope this post will help you. Please put your feedback using comment which helps me to improve myself for next post. If you have any doubts please ask your doubts or query in the comment section and If you like this post, please share it with your friends. Thanks