Project 'ClassLibrary1.csproj' targets 'netstandard2.1'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.8'

Behzad picture Behzad · Aug 7, 2019 · Viewed 11.1k times · Source

I have some class library projects in targets netstandard2.1.

When I referenced that to my WPF project in target .NET Framework v4.8, On building time I get an error:

Severity Code Description Project File Line Suppression State Error Project '..\ClassLibrary1\ClassLibrary1.csproj' targets 'netstandard2.1'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.8'. WpfApp1

What can I do?

Update: I read this Q/A about referencing netcoreapp2.1 and in that answer telling about add netstandar2.1. But my libraries are already in targets netstandard2.1!

Answer

Henk Holterman picture Henk Holterman · Aug 7, 2019

What can I do?

  1. If your library doesn't need the very latest features, use .net standard 2.0
    in general, a library should aim to support the lowest possible version.

or

  1. port your WPF app to .NET Core 3 (preview)

Update:

.Net Core 3 has been released and you can also use the stable version of it.