6

When running on builds in VSO's new host agent pool, I have a powershell script to restore the NuGet packages for each project.json using dnu restore.

This process can easily take more than 2 minutes.

Is it not possible to somehow cache these packages on the agent? Would this only be possible if we had our own custom agent?

Daniel Mann
  • 57,011
  • 13
  • 100
  • 120
Dave New
  • 38,496
  • 59
  • 215
  • 394

2 Answers2

9

Yes, you're right that you need to set up one on-premise TFS build controller and agent to avoid restoring NuGet packages each time when you build projects.

NuGet package restore will install all referenced packages before a project is built, it is possible for you to cache packages on on-premise build agent but not on hosted build agent.

Vicky - MSFT
  • 4,970
  • 1
  • 14
  • 22
  • 5
    It's worth explicitly noting that when you run on a hosted build agent, you are always getting a different build agent. Thus, nothing is cached between builds. – Daniel Mann Aug 05 '15 at 12:47
1

In VSTS (cloud), NuGet Restore task allows you to use NuGet packages from the machine. I have tried this and it cuts on the time it takes to restore all packages.

Setting in NuGet Restore Task

TheVillageIdiot
  • 40,053
  • 20
  • 133
  • 188