.NET framework projects can reference .NET Standard packages, and vice versa
masaeedu opened this issue · 1 comments
I'm seeing the following results on the "Check framework compatiblity" page:
But based on my testing I can create a .NET Standard 2.1 class library (2.0 even), and reference NuGet packages that don't supply any .NET Standard targets with no ill effects other than a warning. E.g. here's a project definition:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="IPNetwork2" Version="2.0.4" />
</ItemGroup>
</Project>
When I attempt to build that, it builds just fine, other than giving me this warning:
/home/ankh/misc_code/ntfsbad/git/agentautomation/framework/lib/Framework/Framework.csproj : warning NU1701: Package 'IPNetwork2 2.0.4' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
I think this is a consequence of a recent "compatibility mode" feature introduced to .NET Standard that is documented here. Is this something that the tool should account for?
I've thought about this quite a bit and I'm not sure what I want to do here. I think best case scenario is to mimic this compatibility mode in the tool and show a similar warning.
I'll think about it more. Just wanted to let you know that I've seen this and I'm considering how much I want to do here. If you have suggestions or would even like to contribute a change, let me know. I'll leave this open until it's resolved somehow.