Any way to ignore all warnings of a nuget package in csproj file
Asked Answered
T

1

5

Is there a way to ignore all warnings of a nuget package by using the

<NoWarn></NoWarn>

tag in csproj file?

Togs answered 7/7, 2022 at 0:26 Comment(0)
S
8

Suppress specific warnings for individual NuGet packages.

In Solution Explorer, select the NuGet package for which you want to suppress compiler warnings.

enter image description here

From the right-click menu or context menu, select Properties.

In the Suppress Warnings box of the package properties, enter the warning number to suppress for this package. If you want to suppress multiple warnings, separate the warning numbers with commas.

enter image description here

The warning has disappeared from Solution Explorer and the error list. In the project file, the NoWarn property will be set.

 <PackageReference Include="NuGet.Build.Tasks.Pack" Version="6.2.0">
   <PrivateAssets>all</PrivateAssets>
   <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
   <NoWarn>NU5104</NoWarn>
 </PackageReference>

hope it helps you.

Selfdelusion answered 7/7, 2022 at 5:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.