0

I have a build in Visual Studio Team Services (VSTS) that needs to restore NuGet packages from a private package feed hosted in VSTS. The build fails with an Unauthorized message (401) when it tries to access the private feed.

After some reading I found out I should use the Microsoft VSTS Credential Provider for NuGet to access the private feed. Normally I wouldn't object to add a tool to each repository, but the thing that bothers me is that this executable is a whopping 14MB and I need to include it in a lot of repositories.

My attempt to resolve this was by adding a 'Download Package'-task for the Credential Provider Package, but that only works for VSTS feeds and not for NuGet feeds.

Now I wonder if I'm doing things correctly here, because this shouldn't be that difficult. Shouldn't the Credential Provider be installed on the buildserver by default or at least be made available as a Task?

Community
  • 1
  • 1
Martin
  • 1,149
  • 7
  • 13

2 Answers2

0

I was able to solve it by exchanging the dotnet restore Task for a NuGet Restore task. That task allows me to point to a VSTS package feed. It's strange that the dotnet restore task doesn't support the credential providers.

Martin
  • 1,149
  • 7
  • 13
  • This is a limitation of the dotnet task right now, which stems from an underlying limitation in dotnet itself. We're aware of the issue and an improved experience is on the backlog. – Alex Mullans May 15 '17 at 05:17
  • For me I also add a "NuGet Tool Installer" task at the beginning of the build and set to 4.3.0 and it fixed the issue – Kiran B May 02 '19 at 14:14
  • Check out the new NuGet Authenticate task, which sets up auth so you can call NuGet or dotnet however you like in a later script step. – Alex Mullans Aug 14 '19 at 18:26
0

You can specify Nuget.config file by specifying –configfile arguments for .Net Core Restore step/task, for example: --configfile $(build.sourcesdirectory) /Nuget.Config.

starian chen-MSFT
  • 33,174
  • 2
  • 29
  • 53