Tuesday, December 13, 2016

How to create .NET Standard library in Visual Studio 2015

In this article I'll show how you can create in Visual Studio 2015 library compliant with some version of .NET Standard.

Recently Microsoft has introduced concept of .NET Standard. Simply speaking it describes some set of functionality. Each version of .NET Standard embraces the previous version and adds some more features. It means that .NET Standard v1.2 includes all capabilities from v1.1 and something more.
On the other hand different platforms (.NET Framework, Xamarine, Windows Phone) support different versions of .NET Standard. It means that if your code is compliant with some specific version than it is garantied to execute on all platforms supporting this version.
This is why it is so usefull to write libraries not for some specific version of .NET Framework, but for specific version of .NET Standard.
To create a library compliant with some version of .NET Standard in Visual Studio 2015 create a new project of type "Class Library (Portable for Android, iOS and Windows)":
Then open properties of this project. Go to the "Library" tab and click on link "Target .NET Platform Standard":
Click "Yes" in the confirmation box. Then select desired version of .NET Standard from the drodown list:
Now save your project and you are ready to code.


No comments:

Post a Comment