1
votes

We are building a Net Core 2.0 project through Azure Devops. It is taking a long time because it keeps redownloading and installing the Nuget packages, taking 5 minutes.

How do I make it build quickly, (example when I rebuild on local Visual Studio, it does not have to redownloa nugets so building only taking a few seconds). How do I make it retain the Nuget packages in the build?

Current YAML Azure Devops Code:

name:  $(Date:yyyyMMdd)$(Rev:.r)
trigger:
- master

pool:
  vmImage: 'vs2017-win2016'

variables:
  buildConfiguration: 'Debug'

steps:
- task: DotNetCoreCLI@2
  inputs:
    command: 'build'
    configuration: $(buildConfiguration)
    projects: "**/*.csproj"
1

1 Answers

1
votes

If you're using the Microsoft-provided hosted agent, there's nothing you can do. It's going to restore the packages every time, because every build is a fresh agent.

The way around it is to set up your own, self-hosted private agent that you can configure however you'd like.