Skip to content

Commit 571c733

Browse files
fix: disable NuGetAudit when AccessToNugetFeed=false to fix CI NU1900
NuGet vulnerability audit queries all sources in nuget.config (including the private Azure DevOps feed) regardless of RestoreSources. When credentials aren't available in CI, this produces NU1900 which TreatWarningsAsErrors escalates to an error. Disable NuGetAudit when AccessToNugetFeed!=true. Also reverts --ignore-failed-sources workaround which didn't help.
1 parent 3e6260d commit 571c733

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

.github/workflows/PR-Build-And-Test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
${{ runner.os }}-nuget-
3030
3131
- name: Restore with dotnet
32-
run: dotnet restore /p:AccessToNugetFeed=false --ignore-failed-sources
32+
run: dotnet restore /p:AccessToNugetFeed=false
3333

3434
- name: Restore local dotnet tools
3535
run: dotnet tool restore

Directory.Packages.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
55
<ToolingPackagesVersion>1.1.1.19025</ToolingPackagesVersion>
66
<AccessToNugetFeed Condition="'$(AccessToNugetFeed)' == ''">false</AccessToNugetFeed>
7+
<!-- Disable NuGet vulnerability audit when the private feed is unavailable (e.g. CI without credentials).
8+
NuGet audit queries all sources in nuget.config regardless of RestoreSources, causing NU1900 which is
9+
escalated to an error by TreatWarningsAsErrors. -->
10+
<NuGetAudit Condition="'$(AccessToNugetFeed)' != 'true'">false</NuGetAudit>
711
</PropertyGroup>
812
<PropertyGroup>
913
<SemanticKernelVersion>1.72.0</SemanticKernelVersion>

0 commit comments

Comments
 (0)