Sharing libraries between .Net Core and .Net Framework applications

I was trying to reference a DLL targeting FW 4.6 in a host application targeting .NET Core 2.1. I started getting this error;

This is where I started to wonder, What’s the difference? How they can co-exist? How the host application can use them?

Microsoft recommend to target .NET Standard 2.0 when building reusable libraries, unless you need to support an earlier version. Most general-purpose libraries should not need APIs outside of .NET Standard 2.0. .NET Standard 2.0 is supported by all modern platforms and is the recommended way to support multiple platforms with one target.

.NET Core 2.1 and later versions support .NET Standard 2.0 and earlier versions.

There will be no new .NET Standard versions after 2.1. For more information, see .NET 5 and .NET Standard later in this article.

.NET Standard libraries and Visual Studio
In order to build .NET Standard libraries in Visual Studio, make sure you have Visual Studio 2019 or Visual Studio 2017 version 15.3 or later installed on Windows, or Visual Studio for Mac version 7.1 or later installed on macOS.

Start from here

Read about .NET standard here

A good explanation about libraries

Resources

FavoriteLoadingAdd to favorites
Spread the love

Author: Shahzad Khan

Software developer / Architect