Skip to content

Fix dnx not authenticating for private feeds#53322

Merged
baronfel merged 3 commits intodotnet:release/10.0.3xxfrom
robertcoltheart:bug/fix-dnx-with-private-feed
Apr 9, 2026
Merged

Fix dnx not authenticating for private feeds#53322
baronfel merged 3 commits intodotnet:release/10.0.3xxfrom
robertcoltheart:bug/fix-dnx-with-private-feed

Conversation

@robertcoltheart
Copy link
Copy Markdown

@robertcoltheart robertcoltheart commented Mar 8, 2026

Fixes #51375

For dnx execution (dotnet tool exec), if the package source is authenticated the previous method of passing an override source meant that the credentials are lost, since this is the equivalient of passing --source https://mysource and ignoring any config in NuGet.config. We need to pass the explicit source for dnx because we confirm with the user that we will be downloading from a particular source (which may be authenticated).

@robertcoltheart
Copy link
Copy Markdown
Author

@baronfel @marcpopMSFT This is ready for review now

@robertcoltheart
Copy link
Copy Markdown
Author

Sorry to ping, @baronfel or @marcpopMSFT are you able to take a look at this?

@Frulfump
Copy link
Copy Markdown

cc @MichaelSimons @MiYanni

@Frulfump
Copy link
Copy Markdown

Is there any test that would make sense to add?

@dsplaisted
Copy link
Copy Markdown
Member

Looks good.

@dotnet/dotnet-sdk Do we have any test private feeds we could use to add a test for this?

@robertcoltheart
Copy link
Copy Markdown
Author

There were never any tests for the dotnet exec command to begin with that I could see. Happy to try and add some, but it may blow out this PR, since it will likely require some refactoring to inject file system services etc.

@marcpopMSFT
Copy link
Copy Markdown
Member

Looks good.

@dotnet/dotnet-sdk Do we have any test private feeds we could use to add a test for this?

@dsplaisted I think we'd need to ask dnceng. They likely have some feeds but creating a specific testcase may be trickier. My recommendation is to take this fix as is and file a separate issue to expand on the testing of tool exec including this scenario as a separate PR. We can probably have copilot generate at least a core of exec tests.

@robertcoltheart
Copy link
Copy Markdown
Author

Thanks all. I added a test for the nuget downloader to ensure it selects the correct source, but further testing for the tool execute command is going to require significantly more refactoring that I'm not comfortable doing as part of this change.

@@ -114,8 +114,9 @@ public override int Execute()
// other feeds, but this is probably OK.
var downloadPackageLocation = new PackageLocation(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This mechanism ("constructing a packageLocation from a common set of nuget-feed-related input options") feels like something we need to be able to extract and share across many of our nuget-related commands. After this merges we should probably try to unify how we do this to prevent regressions like this.

@baronfel
Copy link
Copy Markdown
Member

baronfel commented Apr 6, 2026

Looks good.
@dotnet/dotnet-sdk Do we have any test private feeds we could use to add a test for this?

@dsplaisted I think we'd need to ask dnceng. They likely have some feeds but creating a specific testcase may be trickier. My recommendation is to take this fix as is and file a separate issue to expand on the testing of tool exec including this scenario as a separate PR. We can probably have copilot generate at least a core of exec tests.

The thing I'd immediately reach for is a docker container for a NuGet server - there doesn't seem to be one out in the wild, and the one I did see just used API Key access, and I'm not sure if that would be enough to test with. Will ask the NuGet team about how they'd go about this.

@robertcoltheart
Copy link
Copy Markdown
Author

Thanks for approving. I'm not sure why the build is failing, if someone can perhaps re-run it for me if required?

@baronfel
Copy link
Copy Markdown
Member

baronfel commented Apr 6, 2026

We're having some build infra problems across multiple repos at the moment - as soon as that clears up we'll get the pipelines going here again 👍

@dsplaisted
Copy link
Copy Markdown
Member

With respect to testing, have we done any manual testing to make sure that this fixes the issue?

@robertcoltheart
Copy link
Copy Markdown
Author

Yes I've run this manually in my corporate environment where we use authenticated nuget sources and verified that it works.

@baronfel
Copy link
Copy Markdown
Member

baronfel commented Apr 8, 2026

I don't believe that these test failures are related to this change - they cover publishing which isn't impacted by changes to tool download/invocation.

@baronfel
Copy link
Copy Markdown
Member

baronfel commented Apr 8, 2026

@dotnet/domestic-cat I think the test errors on this PR are indicative of a known build error that we need to log and figure out - can y'all handle that?

@baronfel
Copy link
Copy Markdown
Member

baronfel commented Apr 9, 2026

/ba-g known errors around C++/VS build components not being installed on the newly-recreated base images

@baronfel baronfel merged commit 27547d7 into dotnet:release/10.0.3xx Apr 9, 2026
26 of 29 checks passed
@baronfel
Copy link
Copy Markdown
Member

baronfel commented Apr 9, 2026

/backport to release/10.0.1xx

@baronfel
Copy link
Copy Markdown
Member

baronfel commented Apr 9, 2026

/backport to release/10.0.2xx

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Started backporting to release/10.0.1xx (link to workflow run)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Started backporting to release/10.0.2xx (link to workflow run)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants