net 7.0: adding reference to multitarget project results in NU1702

48 Views Asked by At

I've got a solution with several projects and one of them is multitargetting .NET 7.0 and .NET 4.8. When this project is added a reference to another Blazor WASM project(same solution, through the <ProjectReference> element), the compiler ends up generating the NU1702 warning:

  Microsoft.Common.CurrentVersion.targets(1860, 5): [NU1702] ProjectReference 'some_project' was resolved using '.NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v7.0'. This project may not be fully compatible with your project.

When referencing multitarget libraries through project references, shouldn't we get the correct assembly version? I mean, since the Blazor WASM is targetting .NET 7.0, I expected to the get the .NET 7.0 version without any warnings. It seems like I'm wrong. How can I fix this warning without using the <MSBuildWarningsAsMessafes> options?

Thanks.

0

There are 0 best solutions below