Repository navigation
C#: Exclude private registries from NuGet CLI restores - #22948
Open
michaelnebel wants to merge 4 commits into
Open
michaelnebel wants to merge 4 commits into
michaelnebel wants to merge 4 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
michaelnebel
force-pushed
the
michaelnebel-nuget-public-feeds
branch
from
October 30, 2026 08:08
d2cbfbc to
3badc71
Compare
michaelnebel
marked this pull request as ready for review
October 30, 2026 08:33
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Private-feed filtering can let equivalent registry URLs bypass the proxy and incorrectly suppress the NuGet.org fallback, causing otherwise valid package restores to fail.
2 open issues
What changed in this PR
This PR keeps NuGet CLI restores available for C# packages.config files while excluding organization-configured private registries, rather than disabling the restore step. Private registry support in dotnet restore remains unchanged.
Changes:
- Adds NuGet CLI source filtering and an empty local source when no eligible feeds remain.
- Routes
packages.configrestores through the new source-selection method. - Adds regression coverage and a C# analysis change note.
| File | Description |
|---|---|
csharp/ql/lib/change-notes/2026-10-30-nuget-cli-private-registries.md |
Documents the NuGet CLI restore behavior. |
csharp/extractor/Semmle.Extraction.Tests/FeedManager.cs |
Tests private-feed exclusion, defaults, and empty-source behavior. |
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/PackagesConfigRestorer.cs |
Uses the NuGet CLI-specific source selection. |
csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/FeedManager.cs |
Implements private-registry filtering for NuGet CLI restores. |
Review effort: Max (auto)
Filter private candidates and defaults before choosing the fallback, and compare registry URI identities while preserving path case. Add regressions for missing or unreachable folder feeds and equivalent registry URLs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
michaelnebel
force-pushed
the
michaelnebel-nuget-public-feeds
branch
from
October 30, 2026 10:18
2312379 to
5f27506
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR is mostly generated by CoPilot. We could consider using it instead of completely disabling the use of the NuGet CLI, when private registries are configured (see the referenced PR further down).
However, we still get a lot of error messages in the log, if private registries (and a proxy) are set and if they are a pre-requisite for restoring "anything". @mbg : What is your impression? Should we just exclude private registries from the restore process when using the NuGet CLI or should we completely disable the step?
CoPilots auto generated summary can be seen below.
Summary
Inspired by #22911, keep using the NuGet CLI for
packages.configrestores instead of disabling it when private registries are configured.dotnet restoreunchanged.