dotnet-restore
Restore NuGet package dependencies for a .NET project
TLDR
SYNOPSIS
dotnet restore [project|solution] [options]
DESCRIPTION
dotnet restore downloads and installs all NuGet package dependencies declared in a project, solution, or dotnet-tools.json. It reads PackageReference entries from .csproj/.fsproj/.vbproj files, queries the configured NuGet sources, and writes restored assets to obj/project.assets.json.Other commands like dotnet build and dotnet run trigger an implicit restore by default, so explicit invocation is mainly useful in CI pipelines (where you want to cache the restore step), when troubleshooting package resolution, or when --no-restore is being used downstream.
PARAMETERS
-s, --source SOURCE
NuGet package source to use during restore (overrides nuget.config).--packages DIR
Directory in which to install the restored packages (default: ~/.nuget/packages).--no-cache
Don't cache HTTP requests; always re-fetch from the source.--no-dependencies
Restore only the root project, ignoring project-to-project references.--force
Force all dependencies to be re-resolved even if a cached lock exists.--locked-mode
Don't allow updates to packages.lock.json — fail if it would change.--use-lock-file
Generate or update packages.lock.json.--runtime RID
Target a specific runtime identifier (e.g. linux-x64, win-x86).--configfile FILE
NuGet config file to use instead of the default chain.--disable-parallel
Disable parallel downloads.-v, --verbosity LEVEL
Verbosity: q[uiet], m[inimal], n[ormal], d[etailed], diag[nostic].-?, -h, --help
Display help.
CAVEATS
Restore obeys the standard NuGet config chain: machine-wide, user, and per-directory NuGet.config files. --source replaces (not adds to) configured sources. Setting --locked-mode without an existing packages.lock.json fails immediately.
SEE ALSO
dotnet-build(1), dotnet-add-package(1), dotnet(1)
