NuGet Tool Installer task

Azure Pipelines

Build

Use this task to find, download, and cache a specified version of NuGet and add it to the PATH. For information on the tools cache, see the azure-pipelines-tool-lib repo.

Demands

None

YAML snippet

# NuGet tool installer
# Acquires a specific version of NuGet from the internet or the tools cache and adds it to the PATH. Use this task to change the version of NuGet used in the NuGet tasks.
- task: NuGetToolInstaller@1
  inputs:
    #versionSpec: # Optional
    #checkLatest: false # Optional

Arguments

Argument Description
versionSpec
Version Spec
A version or version range that specifies the NuGet version to make available on the path. Use x as a wildcard. See the list of available NuGet versions. If you want to match a pre-release version, the specification must contain a major, minor, patch, and pre-release version from the list above. Examples: 5.x, 5.4.x, 5.3.1, >=5.0.0-0. If unspecified, a version will be chosen automatically
checkLatest
Always check for new versions
Always check for and download the latest available version of NuGet.exe which satisfies the version spec. Enabling this option could cause unexpected build breaks when a new version of NuGet is released

Tip

If you're using the Microsoft-hosted agents, you should leave this check box cleared. We update the Microsoft-hosted agents on a regular basis, but they're often slightly behind the latest version. So selecting this box will result in your build spending a lot of time updating to a newer minor version.

Open source

This task is open source on GitHub. Feedback and contributions are welcome.

FAQ

Where can I learn more about tool installers?

For an explanation of tool installers and examples, see Tool installers.

Do I need an agent?

You need at least one agent to run your build or release.

I'm having problems. How can I troubleshoot them?

See Troubleshoot Build and Release.

I can't select a default agent pool and I can't queue my build or release. How do I fix this?

See Agent pools.

My NuGet push task is failing with the following error: "Error: unable to get local issuer certificate". How can I fix this?

This can be fixed by adding a trusted root certificate. You can either add the NODE_EXTRA_CA_CERTS=file environment variable to your build agent, or you can add the NODE.EXTRA.CA.CERTS=file task variable in your pipeline. See Node.js documentation for more details about this variable. See Set variables in a pipeline for instructions on setting a variable in your pipeline.