How to convert the .net core library to .net standard?

Nuthan Murarysetty
2 min readJul 22, 2021

--

Here, you will learn the simplest way is to convert from .NET Core Library to .NET Standard.

.NET Framework, .NET Core are two different platforms and it has its own BCL libraries and class libraries.

Current Scenario: The project has one .NET Core library which they referenced in the .NET Core platform applications.

Requirement: They want to use this .NET Core library in the .NET Framework Platform web application/windows application.

Issue: We can’t use this .NET Core library in.NET Framework due to their platform limitations.

Ex: . NET Framework supports only windows and .NET Core is cross-platform. There are many more…

Solution 1: Re-write the .NET Core library code into .NET Framework.

The problem here is code duplication and always code should be sync and maintainable.

Solution 2: Create/Migrate a.NET Standard Class Library to solve the above problem

Using .NET Standard we can create only a class library because it’s not a platform to build any applications.

To migrate the .NET core library to .NET Framework

Step 1: Right-click on the project and click on Edit Project.

Step 2: Inside .csproj file,

<PropertyGroup>

<TargetFramework>netcoreapp3.1</TargetFramework>

<PropertyGroup>

Step 3: Change from netcoreapp3.1, Here I used the 3.1 version and it may be the difference in your project.

<PropertyGroup>

<TargetFramework>netstandard2.0</TargetFramework>

<PropertyGroup>

Step 4: Your .NET Core project is now converted into .NET Standard

Note: There are chances to get libraries compatible issues. If any there then we have to manually fix those.

Step 5: You can directly add this .NET Standard library to any .NET Platform now.

As I promised, this is the simplest way we can achieve our solution. Hope this article helps you and saves you a lot of time.

Thanks for being here and stay safe and be healthy. :)

— Happy Learning :)

--

--

Nuthan Murarysetty

I love sharing things what I know to others and passionate in photography.