Monday, February 20, 2017

How to create a .Net Standard Library

In previous post, I had explained what is .Net Standard. Let’s now use visual studio and see how to build a simple .Net Standard Library.

Using VS 2015:

Creating a .Net Standard library using VS 2015 is not straight forward. Below are the steps.

Create a Portable Class Library and choose any selection of platforms you want
 

Right click on the PCL project in Solution explore and go to properties













As you can see there is an option to change this PCL to a .Net Standard library. Click on it and select yes in  the prompt.











Now this library is .net Standard Library and not a PCL library anymore.










You can see it is using .Net Standard 1.4.

Using VS 2017 RC:


Its straight forward in VS 2017. Create a .Net Standard Library as shown below













The option is directly there when creating a class library.

Now create a simple .Net Standard Library and consume it in .Net core application and a WPF application. We just need to add reference to the .net Standard library as we do for other libraries.

In next post I will explain how .Net Standard library differs from PCL and versioning in .Net Standard Library. Stay tuned.


No comments:

Post a Comment