2
votes

I want to build my .net core application using linux's build agent. But if my nuget is hosted in tfs packages or Azure Artifacts, it can't be restored.

Always get an error when using the dotnet step to restore nuget

/usr/share/dotnet/sdk/2.2.300/NuGet.targets(121,5): error : Unable to load the service index for source http://tfsServer/ProjectCollection/_packaging/guid/nuget/v3/index.json.

/usr/share/dotnet/sdk/2.2.300/NuGet.targets(121,5): error : Response status code does not indicate success: 401 (Unauthorized)

Nuget Task Config

Error Message

I Try:

Refer to the practices mentioned in https://github.com/microsoft/artifacts-credprovider to install the plugin in the linux agent and specify the environment variable VSS_NUGET_EXTERNAL_FEED_ENDPOINTS at compile time. But no effect.

If you are not using nuget of tfs itself. A nuget built with a blank site referenced by nuget.server can be restored normally.

Tfs Server version: Tfs 2018 Update2
Build Agent Linux Server: centos 7.2
Agent version: 2.131

1
There is currently no update, and subsequent attempts will be made to upgrade TFS to Azure Devops Server 2019U1, but there is currently no action. But no matter how this problem is solved under TFS2018?Leolaw

1 Answers

0
votes

According to the similar error in this link: https://github.com/NuGet/Home/issues/6902

You should be able to use a credential provider as mentioned. Please also make sure you have met all prerequisites for it

  • MSBuild on Windows: Install Visual Studio version 15.9-preview1 or later to get the required version of msbuild (15.8.166.59604 or later).
  • NuGet: NuGet(.exe) on the command line version 4.8.0.5385 or later is required.
  • dotnet: dotnet SDK version 2.1.400 or later is required on Windows.

Besides, your build agent version 2.131 is too old. Please upgrade azure-pipelines-agent to latest and try again.