Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS On-Prem Build Agent Using Old Version Of NuGet.exe

We are hosting TFS 2017 Update 2 on-prem, and using on-prem build agents. The latest version of NuGet.exe is currently 4.3.0, but our build agents always default to using v4.0.0. How can I get our build agents to use the latest version of NuGet.exe?

We need to update because NuGet restore is failing when using v4.0.0, but works with v4.3.0, since we are dealing with new .Net Standard 2.0 packages. On our build server I was able to do NuGet.exe update -self to update the NuGet.exe found at C:\Builds\_work\_tool\NuGet\4.0.0\x64\nuget.exe from 4.0.0 to 4.3.0, but that C:\Builds\_work\_tool directory regularly gets deleted and recreated, so this isn't a persistent workaround.

How can I get our build agents to always use the latest version of NuGet.exe, or at least v4.3.0?

like image 953
deadlydog Avatar asked Oct 06 '17 21:10

deadlydog


People also ask

Does Msbuild restore NuGet packages?

msbuild -t:Restore will restore nuget packages for projects with PackageReference nuget management format.

What is NuGet restore in TFS build?

With NuGet Package Restore you can install all your project's dependency without having to store them in source control. This allows for a cleaner development environment and a smaller repository size. You can restore your NuGet packages using the NuGet restore task, the NuGet CLI, or the . NET Core CLI.

What is NuGet restore?

To promote a cleaner development environment and to reduce repository size, NuGet Package Restore installs all of a project's dependencies listed in either the project file or packages. config . The . NET Core 2.0+ dotnet build and dotnet run commands do an automatic package restore.


1 Answers

I know you're not supposed to answer with a link, but this post provides all the details you'll need, confirming that the task does indeed still use 4.0.0, how with VSTS and TFS 2018 you don't have to worry about this anymore (there's a new NuGet Installer task) and how to recreate that kind of task for VS 2017.2 (and earlier) via a PowerShell Script, Using the latest NuGet in your build

like image 120
Greg Duncan Avatar answered Oct 14 '22 00:10

Greg Duncan