Skip to content

C#: Only use reachable feeds when private registries are configured#21385

Open
mbg wants to merge 7 commits intomainfrom
mbg/csharp/reachability-checks-improvements
Open

C#: Only use reachable feeds when private registries are configured#21385
mbg wants to merge 7 commits intomainfrom
mbg/csharp/reachability-checks-improvements

Conversation

@mbg
Copy link
Member

@mbg mbg commented Feb 27, 2026

Some customers only allow access to their own private registries and do not allow access to e.g. the public NuGet feed. This PR refactors and modifies the build-mode: none logic that tests whether feeds are reachable to also check the inherited feeds, and to only pass explicit and inherited feeds which are reachable to dotnet restore.

@mbg mbg self-assigned this Feb 27, 2026
@mbg mbg requested a review from a team as a code owner February 27, 2026 14:42
Copilot AI review requested due to automatic review settings February 27, 2026 14:42
@github-actions github-actions bot added the C# label Feb 27, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the NuGet feed reachability checking logic in C# dependency fetching to support scenarios where customers only have access to private registries and not to public feeds like NuGet.org. The core change is to check both explicit and inherited feeds for reachability, and only pass reachable feeds to dotnet restore.

Changes:

  • Refactored feed reachability checking to test both explicit feeds (from nuget.config files in the working directory and dependabot proxy) and inherited feeds (from nuget.config files outside the working directory)
  • Modified RestoreProjects to receive only reachable feeds instead of all configured feeds
  • Extracted common feed reachability logic into a new GetReachableNuGetFeeds method to reduce code duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants