Skip to content

Commit 53b8011

Browse files
angularsenclaude
andcommitted
Stop failing the build on low/moderate NuGet audit advisories
PR #1657's CI failed at restore time with: error NU1901: Warning As Error: Package 'NuGet.Packaging' 7.0.1 has a known low severity vulnerability error NU1901: Warning As Error: Package 'NuGet.Protocol' 7.0.1 has a known low severity vulnerability These are pulled in transitively by build tooling (CodeGen) and cannot be upgraded without breaking other constraints. Two changes: - Add NU1901 (low) and NU1902 (moderate) to WarningsNotAsErrors in Directory.Build.props so they remain visible as warnings but no longer fail the build via TreatWarningsAsErrors. High (NU1903) and critical (NU1904) advisories still fail the build. - CodeGen.csproj had its own WarningsNotAsErrors that overrode (not appended to) the one in Directory.Build.props. Prefix it with $(WarningsNotAsErrors); so the project inherits the NU codes (and the obsolete codes) while keeping its nullability suppressions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2a60bf9 commit 53b8011

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

CodeGen/CodeGen.csproj

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,18 @@
55
<TargetFramework>net10.0</TargetFramework>
66
<LangVersion>latest</LangVersion>
77
<Nullable>enable</Nullable>
8-
<!-- Allow compile with various nullability warnings until fixed. -->
9-
<WarningsNotAsErrors>8600,8601,8603,8604,8618,8619,8625</WarningsNotAsErrors>
8+
<!--
9+
Inherits Directory.Build.props codes and adds nullability warnings the codegen sources
10+
have not been annotated for. All stay visible as warnings.
11+
CS8600 - null literal to non-nullable
12+
CS8601 - possible null reference assignment
13+
CS8603 - possible null reference return
14+
CS8604 - possible null reference argument
15+
CS8618 - non-nullable field uninitialized in ctor
16+
CS8619 - nullability mismatch
17+
CS8625 - null literal to non-nullable reference
18+
-->
19+
<WarningsNotAsErrors>$(WarningsNotAsErrors);8600;8601;8603;8604;8618;8619;8625</WarningsNotAsErrors>
1020
</PropertyGroup>
1121

1222
<ItemGroup>

Directory.Build.props

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,14 @@
1717
<PropertyGroup>
1818
<!-- Warning instead of compile error on obsolete errors.-->
1919
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
20-
<!-- 612: obsolete, 618: obsolete with message -->
21-
<WarningsNotAsErrors>612,618</WarningsNotAsErrors>
20+
<!--
21+
Warnings stay visible but do not fail the build. NU1903 (high) and NU1904 (critical) still fail.
22+
CS0612 - obsolete member
23+
CS0618 - obsolete member with message
24+
NU1901 - NuGet audit: low severity vulnerability
25+
NU1902 - NuGet audit: moderate severity vulnerability
26+
-->
27+
<WarningsNotAsErrors>612;618;NU1901;NU1902</WarningsNotAsErrors>
2228
</PropertyGroup>
2329

2430
<!-- Build symbol package (.snupkg) to distribute the PDB file for debugging, in addition to Source Link per recommendation: https://learn.microsoft.com/en-us/dotnet/standard/library-guidance/sourcelink -->

0 commit comments

Comments
 (0)