Targeting PCL to .NET Standard

Enterprise application architecture comprises of multiple layers and usually, each layer is representing a separate project. Each project could be a class library project, UWP project, web forms project or ASP.NET MVC project and so on. We usually have a core class library project which is shared across multiple layers and contains some backend and core functionality that every layer can use.

Each platform has a different app model and referencing .NET assembly is not possible until it is a PCL (Portable Class Library). Portable class libraries were used to address these type of scenarios where you can select the app models or platforms while creating a class library and then it can be added to the project to which that library supports.

With the release of .NET Core, Microsoft introduces the next generation of PCL known as .NET Standard. .NET Standard is a set of interfaces that is implemented by different platforms and each .NET Standard has a version number to which that platform supports. There are various versions of .NET Standards to which each platform implements.

Below table shows the .NET standard version and the platform supported.


These arrows specifies the supportability of the platform to a version of a .NET Standard. For example, .NET Core 1.0 supports version 1.6 and it can add any of the platform assemblies lower to that version. However, if we need to reference the .NET Core 1.0 assembly in any of the lower versions of .NET Standard, we need to degrade our .NET core assembly’s .NET standard to that version.

Microsoft is now shifting the .NET Core project extension from .xproj to .csproj. As it is still in the preview it is not recommended to use in production. However, today if you are using .NET Core 1.0.* in production and wanted to reference your .NET Core assembly in any of the other platforms you can use .NET Standard and use the version that supports other projects. However, due to the different project extension .xproj we cannot reference any .NET Core assembly in other platforms for example UWP project that has a .csproj project extension.

However, there is a way as shown in this post through which you can create a .NET Core project with a .csproj extension and then easily reference in other .NET project.

1. Create a Class Library (Portable) project


2, Select the Target platforms.


3. Once this project is created, open up the project properties and click on the “Target .NET Platform Standard” as shown below.


4. This will change the “Target” to .NET Standard version and selected the minimal version from the platforms selected.


5. Finally, you have an assembly which is a .NET Core 1.0 assembly and it can be added to any platform which supports particular .NET standard or lower version.

Hope this helps!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s