dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.71k stars 1.06k forks source link

Add tests for private NuGet feeds in package tab-completion #42776

Open baronfel opened 2 months ago

baronfel commented 2 months ago

Per @zivkan, there's some additional setup we need to do to configure direct use of feeds like we do in the completion scenarios for 'dotnet add package'. His comments below:

Was this tested with a private Azure DevOps feed?

By default, apps using NuGet.Protocol, SourceRepository will not look for credential providers. A static method needs to be called, and then SourceRepository will search for credential providers when it makes requests on feeds that need authentication. Unfortunately, I can't remember the name of the API, so I can't quickly search the code to see if it's being called. But if testing showed that private Azure Artifacts feeds don't work, let me know and I'll look it up.

Originally posted by @zivkan in https://github.com/dotnet/sdk/pull/42349#issuecomment-2292422914

zivkan commented 2 months ago

This is the API that needs to be called in order for NuGet.Protocol to use credential providers:

https://github.com/NuGet/NuGet.Client/blob/3b29ec780c461dd35e95fb6c7237b15583432efb/src/NuGet.Core/NuGet.Credentials/DefaultCredentialServiceUtility.cs#L24

It's already being called in NuGetPackageDownloader, so I hope it's all good already.

baronfel commented 2 months ago

Thanks @zivkan - based on that I've updated this issue to track adding tests to verify our level of support and prevent regressions.