Visual Studio 2022 suppress NU1701 by default

Ofir Magen 21 Reputation points
2023-07-07T16:14:02.2966667+00:00

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).

User's image

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.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,827 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,136 questions
0 comments No comments
{count} votes

Accepted answer
  1. Tianyu Sun-MSFT 28,951 Reputation points Microsoft Vendor
    2023-07-10T08:50:18.9066667+00:00

    Hello @Ofir Magen ,

    Welcome to Microsoft Q&A forum.

    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.

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 60,386 Reputation points
    2023-07-08T20:27:19.9233333+00:00

    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.

    1 person found this answer helpful.

  2. Rekha Narayanaswamy 0 Reputation points
    2023-08-25T08:38:42.6833333+00:00

    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.