dotnet tool restore: Restore Local Tools
dotnet tool restore reads .config/dotnet-tools.json and installs every local tool at the version pinned there.
Local tool manifests make CI reproducible: commit the manifest, run restore, and every runner has the same tool versions.
What it does
dotnet tool restore looks for .config/dotnet-tools.json (the local tool manifest) in the current directory or above it, then installs each listed tool at its pinned version into the local tool cache. After that, dotnet <tool> runs the manifest version.
Common usage
dotnet tool restore
dotnet tool restore --configfile NuGet.config
# then invoke a restored tool
dotnet ef migrations listOptions
| Flag | What it does |
|---|---|
| --configfile <file> | NuGet.config used to resolve the tool packages |
| --tool-manifest <path> | Path to a manifest other than .config/dotnet-tools.json |
| --add-source <url> | Add an extra package source for this restore |
| -v, --verbosity <level> | Output detail level |
In CI
Create the manifest with dotnet new tool-manifest, add tools, and commit .config/dotnet-tools.json. The job step is just dotnet tool restore, which honours the same ~/.nuget/packages cache as package restore, so caching that folder speeds tool restore too. Run it before any step that calls a local tool.
Common errors in CI
"Cannot find a manifest file" means there is no .config/dotnet-tools.json above the working directory; run dotnet new tool-manifest and commit it. "Could not execute because the specified command or file was not found" when calling dotnet ef usually means you forgot dotnet tool restore first. NU1101 means a pinned tool version is no longer on the feed.