.NET Standard is a standard (like html 5 standard) and it has a set of APIs that all .NET platforms have to implement.
Let’s understand this a bit deeper with a scenario.
Let’s say I am building an application and it is based on WPF. So, it will use some version of .net framework as its base class library(BCL). Now let’s say the requirement is to develop a web version of the same and the team want to built it in ASP.Net core. Also, lets say after some days the team now want built an iOS app for the same application.
So now the application has 3 flavors. WPF, ASP.NET Core and iOS app
Below are few issues in above scenario:
- Here clearly the core business of the application will be similar across different platform. Hence, we expect the business library written for one platform to be reused to maximum in other two platforms. Here library means the core business logic. However, we cannot do much code reuse here. The reason is the core libraries of WPF, Asp.Net core and Xamarin iOS app remains different and are not compatible.
- Below is a nice diagram depicting the above
As you see above the base libraries of the 3 platforms are different. Hence library written for one platform won't be supported in the others.
- Also, we need the developer to learn APIs in 3 different libraries to develop same or similar logic.
- One more side effect is, any changes needed done in one library has to be replicated in all the 3 libraries for uniformity.
.Net standard tries to solve the core problem mentioned in above scenario. It is a specification which all the .net platforms will adhere to.
Below is a diagram depicting .Net Standard.
As you observe all the platforms in .Net world now have their core library as .Net Standard. Hence the issues we discussed such as code reuse, developer learning new apis for new platforms will be eliminated.
So, let’s say tomorrow a new platform X comes in .Net world. So, X will adhere to .Net Standard and won’t have its own base library. Hence any application built using platform X can consume a .Net Standard library and improves productivity.
In next post, I will explain how to create a simple .Net Standard based library using VS 2017 RC. Stay tuned.