Liero
Liero

Reputation: 27348

dotnet restore takes too long on VSTS

I have asp.net core 2.0 app, which references Microsoft.AspNetCore.All metadata package

<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />

and I have following build in VSTS which I build using hosted build agent.

Why it always takes min 95 seconds to restore the packages? I thought that

  1. Microsoft.AspNetCore.All packages are cached in ".NET Core runtime store" so they don't have to be restored.
  2. When I restore the packages once, they don't have to be be restored again in every build, since they are cached.

enter image description here

Why is dotnet restore so slow in VSTS?

Edit: Vote for better VSTS build performance here: https://visualstudio.uservoice.com/forums/330519-visual-studio-team-services/suggestions/32044321-improve-hosted-build-agent-performance

Upvotes: 9

Views: 10041

Answers (3)

0x 00
0x 00

Reputation: 51

Try use a solution file instead of **/*.csproj. For me, while restoring **/*.csproj took around 2 mins, restoring the solution file only took 10 seconds.

Upvotes: 5

Sacha K
Sacha K

Reputation: 642

The download of NuGet packages itself is fast, after it actually starts that is.

If you look in the logs the task spends around 1 minute (varies a bit at each build) doing nothing.

From one my last logs, 50 seconds doing nothing:

...
2018-02-04T09:51:47.1349027Z [command]d:\a\_tool\NuGet\4.3.0\x64\nuget.exe restore d:\a\1\s\MySolution.sln -Verbosity Detailed -NonInteractive -ConfigFile d:\a\1\Nuget\tempNuGet_84.config
2018-02-04T09:52:37.2580691Z NuGet Version: 4.3.0.4406
...

Upvotes: 3

Chris Pratt
Chris Pratt

Reputation: 239360

From the Microsoft Docs on Hosted Agents:

Capabilities and limitations

Hosted agents:

  • Run as a service.
  • Have the above software. You can also add software using our tool installers.
  • Provide 10GB of storage.

Hosted agents do not offer:

  • Interactive mode.
  • Administrator privileges.
  • The ability to log on.
  • The ability to drop artifacts to a UNC file share.
  • The ability to run XAML builds.
  • Potential performance advantages that you might get by using private agents which might start and process builds faster. Learn more

If our hosted agents don't meet your needs, then you can deploy your own private agents.

Long and short, using the hosted agents, what you get is what you get. If it's not fast enough for you or doesn't do something else you'd like (such as caching of NuGet packages), then your recourse is to create your own private build agent.

Upvotes: 3

Related Questions