I'm working on a WPF project targeting .NET 6.0, and my task is to get rid of all the compiler warnings. One of the libraries we're using is Helix, which is giving us the NU1701 warning:
Error NU1701 Warning As Error: Package 'HelixToolkit.Wpf.SharpDX 2.23.0' 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, .NETFramework,Version=v4.8.1' instead of the project target framework 'net6.0-windows7.0'.
I know I can suppress it, but I didn't want to cover up a potential bug by doing so. In fact, a few of the projects in our solution already had it suppressed.
Initially I thought it was done by a developer, but I just realized that VS 2022 project template has it suppressed by default (I saw it for WPF, Console App and C# Library).
I'm looking for the reasoning behind this. I am wondering if this is enough of a reason for me to just not worry about it.
I’m looking for the reasoning behind this.
The default suppressed warnings that you realized should be
CS1701
and
CS1702
(without the CS prefix). They are different from NU1701 and NU1702. So, the NU1701 error that you got wasn’t suppressed by VS by default.
I am wondering if this is enough of a reason for me to just not worry about it.
The NU1701 warning describes clearly, the package is for .NET Framework, not for .NET. So, if you install and use it, you may or may not get incompatibility issues. For your specific error, please kindly check Bruce’s answer above.
Sincerely,
Tianyu
If the answer is the right solution, please click "
Accept Answer
" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our
documentation
to enable e-mail notifications if you want to receive the related email notification for this thread.
HelixToolkit.Wpf.SharpDX is a .net 4.* dll. the .net core runtime and the .net 4.* runtime are not completely compatible. 4.* dll's hosted by .net core can easily crash due to these incompatibilities and are not supported.
you get rid of the warning, by replacing HelixToolkit.Wpf.SharpDX with a .net core compatible version.
i'm also facing the same issue . can you please suggest how to resolve this issue
Warning NU1701 Package 'xx 0' 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, .NETFramework,Version=v4.8.1' instead of the project target framework 'net7.0'. This package may not be fully compatible with your project.
Hi
@Rekha Narayanaswamy
,
NU1701
is a warning not an error, your project may run correctly.
To solve this warning, either change your project’s target framework to one that the package supports or change to use another NuGet package which supports your project’s target framework.
The error message is clear, your project targets .NET 7.0 but the NuGet package you are using only supports .NET Framework, not .NET(
difference between .NET and .NET Framework
).