Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 476
Liero Avatar asked Oct 27 '17 13:10

Liero


People also ask

Is dotnet restore necessary?

In most cases, you don't need to explicitly use the dotnet restore command, since a NuGet restore is run implicitly if necessary when you run the following commands: dotnet new. dotnet build. dotnet build-server.

What is the difference between NuGet restore and dotnet restore?

nuget restore will ensure all of your NuGet dependencies are downloaded and available to your project. Whereas dotnet restore is a complete restoration of all NuGet dependencies as well as references and project specific tools. Meaning that if you run nuget restore , you are only restoring NuGet packages.

What is dotnet restore used for?

Description. The dotnet restore command uses NuGet to restore dependencies as well as project-specific tools that are specified in the project file.


1 Answers

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.

like image 169
Chris Pratt Avatar answered Sep 21 '22 04:09

Chris Pratt