skip to Main Content

One of the later versions of Visual Studio started showing vulnerability messages.

enter image description here

I looked at the issue – high CPU in certain cases. It doesn’t affect my use case.

How do I get Visual Studio to stop showing me this warning? I’ve tried adding the code into the portion in the csproj, but it persists.

2

Answers


  1. Add the following code to the .csproj file to make the entire project ignore the NU1902 warning:

    <PropertyGroup>
      <NoWarn>$(NoWarn);NU1902</NoWarn>
    </PropertyGroup>
    
    Login or Signup to reply.
  2. @stuartd’s suggestion in comment worked for me (it was only missing nuget restore):

    1. add NoWarn="NU1901" in your PackageReference:
    <PackageReference Include="Contoso.Library" Version="1.0.0" NoWarn="NU1901" />
    
    1. run nuget restore (<– this step is mandatory otherwise I still had the issue)

    I’ve also tested:

    <ItemGroup>
        <NuGetAuditSuppress Include="https://github.com/advisories/XXXX" />
    </ItemGroup>
    

    as stated in this doc: https://learn.microsoft.com/en-us/nuget/concepts/auditing-packages#excluding-advisories
    but it did not work.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search