.NET Standard Library code sharing
.NET Standard libraries have a uniform API for all .NET Platforms including Xamarin and .NET Core. Create a single .NET Standard Library and use it from any runtime that supports the .NET Standard Platform. Refer to this chart for details of supported platforms.
While .NET Standard versions 1.0 through 1.6 provide incrementally larger subsets of the .NET Framework, .NET Standard 2.0 provides the best level of support for Xamarin applications and for porting existing Portable Class Libraries.
Visual Studio for Mac
This section walks through how to create and use a .NET Standard Library using Visual Studio for Mac.
Creating a .NET Standard Library
You can add a .NET Standard Library to your solution with these steps:
In the Add New Project dialog, select the .NET Core category and then select .NET Standard Library:
On the next screen, choose the target framework - .NET Standard 2.0 is recommended:
On the final screen, type the project name and click Create.
The .NET Standard Library project will appear as shown in the Solution Explorer. The Dependencies node will indicate that the library uses the NETStandard.Library.
Editing .NET Standard Library settings
The .NET Standard Library settings can be viewed and changed by right-clicking on the project and selecting
Options as shown in this screenshot:
Inside you can change your version of
netstandard by changing the
Target Framework dropdown value.
Additionally: You can edit the
.csproj directly to change this value.
.NET Standard and Xamarin.Forms for the .NET Developer (video)
- .NET Standard - detailed information and comparison to PCL.