When I started learning .Net Core some time ago I was constantly encountering a ‘.Net Standard’. I knew what it means and that it is (somehow 😉 ) important for me but didn’t really care about it. It’s just the standard, right? Who would care about it, when there is so many new things to discover (yep, I was an ignorant!). I changed my mind the last week – when the .Net Standard 2.0 was finally released.
So, what the .Net Standard is?
It is the standard common for every .Net technology. It ensures that your app/library is compatible with all the .Net technologies (ex. asp.net core, asp.net, xamarin) so you can reuse the same piece of code in more than one product without a need of recompiling it.
What it gives you?
Well, obviously, .Net Standard is something you should have in mind when you are developing a Nuget package. But let’s be honest, writing and publishing a Nuget package is not what most of us do on daily basis.
At the same time, most of us writes classes or even whole libraries that are useful in an Asp.Net web app and could be useful in a Xamarin mobile app that is being developed by a collegue. Realistic scenario? I think so!
Need more examples? What about (again) a Nuget package that was coded, let’s say, 10 years ago and wasn’t changed since? There is an enormous chance (about 70% to be more precious) that you can use it in your app, if the app is .Net Standard 2.0 compatible. Pretty cool, huh?
What technologies supports .Net Standard?
Of course, you will not find here Windows Forms but the list is quite promising:
• .NET Core 2.0
• .NET Framework 4.6.1
• Mono 5.4
• Xamarin.iOS 10.14
• Xamarin.Mac 3.8
• Xamarin.Android 7.5
• the future version of UWP
To develop an application compatible with .Net Standard 2.0 you will need the newest version of Visual Studio (Visual Studio 2017 update 15.3).
.Net Standard 2.0 APIs list
Sadly, the standard doesn’t contain all of the .Net framework APIs. But the difference between .Net Standard 2.0 and 1.x is huge – the 2.0 version has +20’000 (yep, 20K) more APIs than its previous version. Impressive, isn’t it? The added APIs are listed below.
- XML: XLinq, XML Document, XPath, Schema, XSL
- Serialization: BinaryFormatter, Data Contract, XML
- Networking: Sockets, HTTP, Mail, WebSockets
- IO: Files, Compression, MMF
- Threading: Threads, Thread Pool, Tasks
- Core: Primitives, Collections, Reflection, Interop, Linq
- Data: DataSet, Data Table
That’s it about the .Net Standard. In the next post (which, I hope, will appear really soon) I will focus on .Net Core 2.0. So drop in if the subject interests you.
Most of the above information comes from Microsoft video which I strongly recommend!