Over the last few years .NET developers have been given an opportunity to develop software targeting a genuinely diverse set of devices, operating systems and platforms (.NET Framework, Xamarin, .NET Core). This has been mostly a blessing but the subtle differences in each stack (sometimes not so subtle) has started to create underlying issues around portability. So if you created a handy Nuget package the question of which .NET developers could take advantage of it has become a complex question, and this is mostly due to the various implementations of Base Class Library (BCL).
As you know the BCL contains your primitive types and frankly each version of .NET was created by a multitude of different teams of developers and so namespaces and classes got slightly different implementation, again negatively impacting your chances of true cross platform development. So how do you unify the various BCLs?
Why the .NET Standard?
The .NET Standard is a specification and it represents a set of APIs that all current and future .NET platforms have to implement.
- The .NET Standard defines what is consistently available across each version of .NET
- Cross platform developers can focus on mastering the standard rather than the platform
This may sound immediately familiar in that this was what Portable Class Libraries were supposed to accomplish, and to a certain extent it did. The problem here was that the PCL was an afterthought rather than a strict standard, and so each .NET platform team could decide whether or not they would implement an API, this inconsistent approach was immediately problematic for everyone outside of Microsoft.
Which .NET Standard to use?
Higher version of the .NET standard include the lower versions so if, for example, you build .NET Standard version 1.6 application you are compatible with version that include 1.3 and/or 1.0. To see exactly what API and namespaces you get to target check out the .NET API Browser. The APIs of .NET site also allows you to search for a particular class and see which standard and platforms are support.
Generally speaking you should select the lowest version of the .NET Standard that you can accept, this will provide the broadest base of compatible platforms and user experiences.
Over the next few weeks I am going to checking out how this approach can assist me bringing an application like DasBlog up to speed.
Comments are closed.