简体   繁体   中英

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

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

<NoWarn></NoWarn>

tag in csproj file?

Suppress specific warnings for individual NuGet packages.

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

在此处输入图像描述

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.

在此处输入图像描述

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM