Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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!

like image 262
Behzad Avatar asked Aug 07 '19 06:08

Behzad


People also ask

What version of NET Standard does classlibrary1 target?

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

What version of Net6 does csproj target?

[VS2022 p7] Project 'xxxx.csproj' targets 'net6.0'. It cannot be referenced by a project that targets 'Xamarin.iOS,Version=v1.0' #13201

Can I add a reference to a project that targets netframework?

It cannot be referenced by a project that targets '.NETFramework,Version=v4.7.2'. Person_WebApp I already changed the UI Web App Framework to v 4.6.1, v4.5, I still get the same error. Please help! .. You cannot add a reference to a .NET Core project to a .NET Framework project.

Can it be referenced by a project that targets'netcoreapp V5'?

It cannot be referenced by a project that targets '.NETCoreApp,Version=v5.0' · Issue #12559 · dotnet/sdk · GitHub Have a question about this project?


1 Answers

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 or later
like image 118
Henk Holterman Avatar answered Sep 20 '22 04:09

Henk Holterman