Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS Build Agent failed on Nuget Restore for: .Net Core + VS 2017 + private TFS Feed

I have: a .NET Core App, modified for VS 2017 and consuming a TFS Feed. When it was in VS 2015, NuGet restore was working fine. Now using VS 2017, NuGet restore it doesn't work returning a Failed to load msbuild Toolset ... Could not load file or assembly 'Microsoft.Build, Version=14.0.0.0

I also try to use dotnet restore and I got a 401 (Unauthorized) response.

Apparently NuGet restore is the preferred way to do it, since it automatically authenticated for us, in order to use TFS Feed, but it seems to don't recognize VS 2017.

Update 3/20/2017

Sorry for the confusion, I forgot to mention that the problem is using CI/CD Visual Studio Team Services / Build. In my PC, it works fine because I had NuGet 4 (it come with VS 2017)... but online the NuGet versions available (with access to private feed) are: 3.3 and 3.5

Update 3/25/2017

After I added the nuget 4.0 to the build as @Cece-MSFT suggested, I still getting an error but without much detail. see screenshot: enter image description here

like image 419
Jaider Avatar asked Mar 17 '17 05:03

Jaider


2 Answers

Finally, some upgrades and there are 2 options, how to solve this:

  1. Instead of using NuGet v3.3 and v3.5... there is now support for NuGet v4.0

enter image description here

  1. And my Favorite, It's to use a NuGet Restore version v1.*, and now I have the option to select my own VSTS Feed... so I don't need the NuGet.config file anymore.

enter image description here

like image 89
Jaider Avatar answered Jan 04 '23 06:01

Jaider


You could use the nuget global config file of your build server located in %APPDATA%\NuGet\NuGet.Config

like image 34
k4st0r42 Avatar answered Jan 04 '23 06:01

k4st0r42