Skip to content

Fix restore source name resolution#7311

Draft
nkolev92 wants to merge 3 commits intodevfrom
dev-nkolev92-resolveSources
Draft

Fix restore source name resolution#7311
nkolev92 wants to merge 3 commits intodevfrom
dev-nkolev92-resolveSources

Conversation

@nkolev92
Copy link
Copy Markdown
Member

Bug

Fixes: NuGet/Home#5849

Description

This change fixes restore so explicit sources provided by name in NuGet.Config are resolved correctly instead of being treated as relative file system paths.

It adds regression coverage for:

  • nuget.exe -Source
  • dotnet restore --source
  • msbuild /p:RestoreSources

No docs change is needed for this bug fix.

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc.

Resolve explicit restore sources against enabled package source names from NuGet.Config before treating them as paths. Add regression coverage for nuget.exe, dotnet restore, and MSBuild restore.

Co-authored-by: Copilot <[email protected]>
@nkolev92 nkolev92 force-pushed the dev-nkolev92-resolveSources branch 2 times, most recently from 19d53e1 to cf044d8 Compare April 21, 2026 18:32
var workingDirectory = Path.Combine(pathContext.SolutionRoot, projectName);
var projectFile = Path.Combine(workingDirectory, $"{projectName}.csproj");

_dotnetFixture.CreateDotnetNewProject(pathContext.SolutionRoot, projectName, "classlib -f netstandard2.0", testOutputHelper: _testOutputHelper);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@copilot We don't need to set a specific framework, just create a regular classlib.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Updated in e34115b: the test now creates a regular class library (classlib) without forcing a framework.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

restore does not support passing sources by name from the config file

2 participants