Have been coding in .NET ecosystem for years, I know the term .NET Framework. I know that there are many versions of the framework from 1.0 to 4.x. Honestly, I did not care much about them. Well, because I have not had such a need.
Recently, there are “.NET Core” and “.NET Standard”. Officially, I have to deal with 3 terms. I must get my head around them. I must try to get a sense of them, as a developer.
.NET Framework
The latest documentation from Microsoft is here. There is so many useful information from the documentation page. But it also is too much to absorb. To absorb, I need a shorter version of the explanation. I need to draw a picture on my head. And here it is
Just in case you need a detail view, ask Google dot net framework architecture diagram. I cannot remember them. And most importantly I do not need to know that much.
Framework Class Library
Give us a huge amount of classes, API that we can use to build applications. When you build Windows applications, WPF, ASP.NET, … you user Framework Class Library. Class Library is a visual thing that you can use it directly. And most of the time, we just need to care about them. We, as developers, usually care
- Available API to do certain things, such as how to write to a file, open a file, how to write to Console, …
- Supported types, such as String, Int, Double, …
- How to create a class, a struct.
- How to iterate throw a collection such as for, foreach, … keywords
Common Language Runtime (CLR)
It guarantees this: Hey, do not worry. I got your back. Just do whatever Framework Class Library supports and we take care of the rest. As business application developers, we do not have to care about CLR. Of course, there is time CLR acts incorrectly or causes problems. But that is rare.
The CLR will handle the communication with underlying OS (which is Windows).
Key points
- Windows only. The code you write cannot run on Mac, Linux.
- Common Language Runtime (CLR)
- Framework Class Library
We use Framework Class Library to build our application, then CLR takes care of dirty job to ensure the code runs on Windows OS.
.NET Core
.NET Core is a general purpose, modular, cross-platform and open source implementation of the .NET Platform. It contains many of the same APIs as the .NET Framework (but .NET Core is a smaller set) and includes runtime, framework, compiler and tools components that support a variety of operating systems and chip targets. The .NET Core implementation was primarily driven by the ASP.NET Core workloads but also by the need and desire to have a more modern runtime. It can be used in device, cloud and embedded/IoT scenarios.
From official MS Documentation site.
There are many materials out there. There are videos, training. However, what important is how I read them. In my way, to ensure I understand, I must be able to draw an image in my head.
Let’s seek and extract information that I think they are important.
The first important bit is cross-platform. Put it simply our code can run on Linux.
Look pretty much the same as the .NET Framework with some differences
- More supported OS: Windows, Linux and Mac
- A smaller set of supported API. The “Class Library” box is smaller than in .NET Framework.
Gradually, the support API box will be bigger and bigger. Oh, one might ask why do I need to
Q: Oh, one might ask why do I need to use .NET Framework when there is .NET Core?
A: Because, the “Class Library” box of .NET Framework is a lot bigger. It will take a lot of time and effort to close the gap.
.NET Standard
The .NET Standard is a formal specification of .NET APIs that are intended to be available on all .NET runtimes. The motivation behind the .NET Standard is establishing greater uniformity in the .NET ecosystem. ECMA 335 continues to establish uniformity for .NET runtime behavior, but there is no similar spec for the .NET Base Class Libraries (BCL) for .NET library implementations.
From the official MS documentation. The key point here is “a formal specification of .NET APIs“. It is not an implementation. Its place in a big picture
From source here.
What it means is if your code use API described in NET Standard, it can be used in .NET Framework, .NET Core and Xamarin.
I want to express in my own way
Here is what NET Standard ultimately means
Therefore, when you develop a new feature, API and you want to reuse it many places. NET Standard is a good choice to make. Code again a Contract not an Implementation.
This is a high-level overview of the 3 concepts: .NET Framework, .NET Core, and .NET Standard. My objective is to draw images in my head about them. I understand them better in this way. I hope you can benefit from my way of viewing them.
With those images in mind, when someone prefers about one of them, I can immediately recall it. With the paradox of choices we have today, know what to take is important.