How to hide .NET Core compatibility warnings when accessing .NET 4.6. NuGet package in VS 2017.3

I am working on a .NET CLI application that should reference a third-party NuGet package that has not been published for the purpose netcoreappX.X. I launched the Analyze Project Portability tool and got the 100% compatibility that is expected since it is a relatively simple library.

The problem comes in the form of this annoying NuGet warning:

Warning: NU1701
    Package "XXXXXX 1.0.0" was restored using ".NETFramework, Version = v4.6.1" instead of the target target platform ".NETCoreApp, Version = v2.0". This package may not be compatible with your project.

Is there a way to hide this warning for a specific NuGet package?

+4
source share
1 answer

I found the answer to my question in a search on Google Images that led me to this seemingly unrelated SO post:

Suppressing Roslyn Code Analyzers Issues

In short, the NuGet package link properties page has a NoWarn attribute , where an error code can be specified, as shown in the following figure:

enter image description here

+5
source

Source: https://habr.com/ru/post/1683908/


All Articles