It’s hard to read an intro to .NET Core without someone also introducing .NET Standard and then quickly moving on, leaving you to wonder just what is the .NET Standard. I’ve seen the same questions come up over and over again. Is it another framework I have to learn? Is it the old .NET? Is .NET Standard and .NET Core the same? Hopefully we can answer all those questions today!
.NET Standard Is Exactly That. A Standard.
.NET Standard is for lack of a better word, a standard. It’s a description of the core interfaces that every .NET platform should implement if they wish to say “I support .NET Standard 2.0” for example.
An easy way to see what exactly the standard defines is actually the nuget package here : https://www.nuget.org/packages/NETStandard.Library . If you scroll down you will see descriptions of what each standard defines. So for example, .NET Standard 1.1 introduces System.Linq. If you would like to use System.Linq, you will need to use a platform that implements .NET Standard 1.1.
That brings us to the next point….
What Is A Platform?
It’s may be also good to take a step back and look at what exactly is a platform. At the moment the Microsoft .NET platform list looks like.NET Framework (Old .NET), .NET Core, Xamarin, Universal Windows Platform (UWP), Windows Phone and now also Mono.
Each platform version will implement a specific .NET Standard version. So for example, .NET Framework Version 4.6 implements the .NET Standard 1.3, whereas .NET Core Version 1.0 implements .NET Standard 1.6. If I were to write a library that I wanted a developer to use in both .NET Framework Version 4.6 and .NET Core Version 1.0, then I would have to target the lowest .NET Standard that these platforms implement. That being .NET Standard 1.3 in this case.
Microsoft have released an easy to view “chart” that tells you which version of each platform implements each version of the standard. You can see it here.
It’s important to note that each platform can implement it’s own features. Windows Phone for example may implement phone specific classes and interfaces, but it will also expose a classes and interfaces of it’s corresponding .NET Standard.
Read also: Net Core 3.0 Preview
When Do You Have To Worry About It?
If you are writing for a particular platform, you usually don’t have to worry about .NET Standard at all. You may at times wish to look up the standard to see what would be coming to your platform next release, but that’s about it.
If you are developing your own library that you wish to be used across multiple platforms, that’s when the .NET Standard comes in handy. If you write a library that you want working on .NET Core, UWP, Windows Phone and .NET Framework, you will need to only use classes that are available on all of those platforms. How do you know what classes are available on all platforms? The .NET Standard!
What we will likely see in the future from library developers is the requirements changing from “You need .NET Framework version 4.6” to, “This is built on top of .NET Standard 1.6”. And from there you can go and look up what platforms use that standard.
A Web Analogy
There is one big difference however. Unlike ECMAScript (And other web technologies like CSS), it’s hoped that platforms implement an all or nothing approach when it comes to moving up the .NET standard ladder. Either you implement .NET Standard 1.5 or 1.6, but you don’t release a platform version that implements 1.5 and a few features from 1.6. Remember, .NET Standard is supposed to make it “easy” to determine what classes and interfaces you have available.
I’ll admit, I’m still wrapping my head around how .NET Standard works. But it’s early days yet. You can go to the Microsoft Github and see people still discussing how things should work long term, so it’s not just your everyday developer trying to work it out. If you have any questions feel free to comment below and I’ll do my best to answer.
6 thoughts on “.NET Standard vs .NET Core – What’s The Difference?”
Thanks for the explanation. It helps a lot!
Nice explanation about .Net Standard. I’m still struggling to understand what .Net core is though! Can you recommend a good article?
There is this article on “why” you might want to use .net core in your next project : http://220.127.116.11/~dotnetco/2016/12/30/5-reasons-start-next-project-asp-net-core/
But essentially it’s the .net platform rebuilt to run on Linux, Mac and Windows machines. At the same time Microsoft has taken the opportunity to “rebuild” certain things within the ASP.net framework (Since it’s new, you can afford to break a few eggs and get things right first time).
If you’ve used the .net framework before to build an ASP.net site, then asp.net core is just a way to build that same site using many of the existing patterns you know, but have it run on Linux machines (Which when you are running on say Azure websites, is half the price of a Windows machine). There is a small learning curve with some new paradigms introduced (Middleware, ServiceCollection, Kestrel, .net CLI/SDK), but for the most part if you know ASP.net, it should only take a day or so to get up to speed.
Thank you so much for the explanation.
Great explanation! Thanks a lot!
Thanks, great post and easily understandable! The link to the Microsoft’s chart for platform-.net standard relations is also very useful!