Skip to content

NuGetRestore Task

Aaron Jensen edited this page Sep 27, 2019 · 1 revision

Overview

The NuGetRestore task restores NuGet packages. Set the Path property to the path to the solution file, packages.config file, Microsoft Build project, or a project.json file whose packages you want to restore.

By default, NuGetRestore downloads and used the latest version of NuGet. Set the Version property to pin this task to a specific version of NuGet.

You can pass custom arguments to NuGet.exe via the Argument property. Arguments are passed as-is. Argument should be an array of arguments.

The NuGet executable doesn't report success or failure. If the NuGet restore fails, you'll see compilation errors instead of a problem with this task.

Examples

Example 1

Build:
- NuGetRestore:
    Path: MySolution.sln

This demonstrates how to restore the NuGet packages for a Visual Studio solution.

Example 2

Build:
-NuGetRestore:
    Path: MySolution.sln
    Version: 4.1.0

This demonstrates how to pin the task to use a specific version of NuGet, in this case, 4.1.0. Without the Version attribute, the latest version of NuGet is used.

Example 3

Build:
-NuGetRestore:
    Path: packages.config
    Argument:
    - "-PackagesDirectory"
    - $(WHISKEY_BUILD_ROOT)\packages

This demonstrates how to pass custom arguments to NuGet.exe with the Argument property. In this example, packages will be put in a packages directory in the build root (i.e. the same directory as your whiskey.yml file).

Clone this wiki locally