How to reference .net framework 4.8 nuget package from .net standard 2.0 class library?

Viewed 18

I'm trying to use .net framework 4.8 nuget package (which was written by our team) in my .net standard 2.0 class library. But when I build the solution I see such kind of warning:

Warning NU1701
Package ... was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.

At the same time here it is claimed that .net standard and .net framework 4.8 are compatible.

Why do I see this warning? What am I doing wrong? Is there way to get rid of this warning?

1 Answers

They're compatible in the sense that you can reference netstandard projects from net48 projects, but not the other way round.

The only thing you can reference from a netstandard project is another netstandard project

Related