dotnet-restore(1)
π dotnet-restore(1) β .NET Documentation β¨
okay bestie, welcome to the manual page for dotnet restore π the manual name is literally right there in the title, dotnet-restore(1), so now you know what you're reading.
This article applies to: βοΈ .NET 6 SDK and later versions. yes, only the cool newer SDKs. periodt.
π NAME π
dotnet-restore β Restores the dependencies and tools of a project.
lowkey the whole personality in one line, and honestly? iconic.
π SYNOPSIS π
dotnet restore [<PROJECT>|<SOLUTION>|<FILE>]
[-a|--arch <ARCHITECTURE>] [--configfile <FILE>] [--disable-build-servers]
[--disable-parallel] [-f|--force] [--force-evaluate]
[--ignore-failed-sources] [--interactive] [--lock-file-path <LOCK_FILE_PATH>]
[--locked-mode] [--no-dependencies] [--no-http-cache]
[--os <OS>] [--packages <PACKAGES_DIRECTORY>]
[-r|--runtime <RUNTIME_IDENTIFIER>] [-s|--source <SOURCE>]
[--tl:[auto|on|off]] [--ucr|--use-current-runtime] [--use-lock-file]
[-v|--verbosity <LEVEL>]
dotnet restore -h|--help
π¦ DESCRIPTION π¦
so here's the tea β a .NET project usually references external libraries that live in NuGet (https://www.nuget.org) packages, and those packages are what give your project the extra functionality it needs. those external dependencies get referenced in the project file (.csproj or .vbproj). when you run the dotnet restore command, the .NET CLI pulls up NuGet to go looking for those dependencies and downloads them if it has to. it also makes sure every dependency the project needs actually plays nice with all the others, and that nothing is beefing with anything else (no conflicts, we don't do that here π
).
once the command finishes, all the dependencies your project needs are chillin' in a local cache, ready for the .NET CLI to build and run the app. slay.
most of the time you do not need to explicitly type dotnet restore, because if a NuGet restore is necessary, these commands just run it implicitly behind your back:
dotnet newdotnet builddotnet build-serverdotnet rundotnet testdotnet publishdotnet pack
but sometimes running that implicit NuGet restore with those commands is justβ¦ inconvenient, ngl. for example, some automated systems β build systems and stuff β need to call dotnet restore explicitly so they can control when the restore happens, which means they get to control network usage. makes sense. and if you wanna stop the implicit NuGet restore from happening, you can use the --no-restore flag with any of those commands. bye π
Signed package verification during restore operations requires a certificate root store that is valid for both code signing and timestamping. For more information, see NuGet signed package verification.
π Specify feeds π
to restore the dependencies, NuGet needs the feeds where the packages are actually located. feeds are usually handed over via the nuget.config configuration file, and a default configuration file comes pre-installed when you set up the .NET SDK. wanna specify extra feeds? do one of these:
- create your own
nuget.configfile in the project directory. for more info, see Common NuGet configurations and nuget.config differences later in this article. - use
dotnet nugetcommands likedotnet nuget add source.
and psst β you can override the nuget.config feeds with the -s option. π
for info on how to use authenticated feeds, see Consuming packages from authenticated feeds.
π Global packages folder π
for dependencies, you can pick where the restored packages get placed during the restore operation using the --packages argument. if you don't specify it, the default NuGet package cache is used, and that lives in the .nuget/packages directory in the user's home directory on all operating systems. for example, /home/user1 on Linux or C: on Windows.
π§ Project-specific tooling π§
for project-specific tooling, dotnet restore first restores the package that the tool is packed in, and then goes on to restore the tool's dependencies as specified in its project file. one step at a time, bestie.
πΈ nuget.config differences πΈ
the behavior of the dotnet restore command is affected by the settings in the nuget.config file, if it's there. for example, setting the globalPackagesFolder in nuget.config puts the restored NuGet packages in the folder you specified. that's an alternative to passing the --packages option on the dotnet restore command. for more info, see the nuget.config reference.
and listen β there are three specific settings that dotnet restore straight up ignores:
bindingRedirects
Binding redirects don't work with <PackageReference> elements, and .NET only supports <PackageReference> elements for NuGet packages.
solution
This setting is Visual Studio specific and doesn't apply to .NET. .NET doesn't use a packages.config file and instead uses <PackageReference> elements for NuGet packages.
trustedSigners
Support for cross-platform package signature verification was added in the .NET 5.0.100 SDK.
β Workload manifest downloads β
when you run this command, it kicks off an asynchronous background download of advertising manifests for workloads. and if that download is still running when this command finishes, the download gets stopped. for more info, see Advertising manifests.
π«Ά ARGUMENTS π«Ά
PROJECT|SOLUTION|FILEβ the project or solution or C# (file-based app) file to operate on. if you don't specify a file, MSBuild goes searching the current directory for a project or solution.PROJECTis the path and filename of a C#, F#, or Visual Basic project file, or the path to a directory that contains a C#, F#, or Visual Basic project file.SOLUTIONis the path and filename of a solution file (.slnor.slnxextension), or the path to a directory that contains a solution file.FILEis an argument added in .NET 10. the path and filename of a file-based app. file-based apps are contained within a single file that is built and run without a corresponding project (.csproj) file. for more info, see Build file-based C# apps.
π OPTIONS π
-a|--arch <ARCHITECTURE>β specifies the target architecture. this is a shorthand syntax for setting the Runtime Identifier (RID), where the value you provide gets combined with the default RID. for example, on awin-x64machine, specifying--arch x86sets the RID towin-x86. if you use this option, do not also use the-r|--runtimeoption (pick a lane bestie π). available since .NET 6 Preview 7.--configfile <FILE>β the NuGet configuration file (nuget.config) to use. if you specify it, only the settings from this file get used. if you don't, the hierarchy of configuration files from the current directory gets used. for more info, see Common NuGet Configurations.--disable-build-serversβ forces the command to ignore any persistent build servers. this option is the consistent way to disable all use of build caching, which forces a build from scratch. a build that doesn't rely on caches is super useful when the caches might be corrupted or just plain wrong for some reason. available since .NET 7 SDK.--disable-parallelβ disables restoring multiple projects in parallel. one at a time, we're being chill about it.--forceβ forces all dependencies to be resolved even if the last restore was successful. specifying this flag is the same as deleting theproject.assets.jsonfile. same energy, different button.--force-evaluateβ forces restore to reevaluate all dependencies even if a lock file already exists.--ignore-failed-sourcesβ only warn about failed sources if there are packages meeting the version requirement.--interactiveβ allows the command to stop and wait for user input or action. for example, to complete authentication. it'll just sit there waiting for you, patiently π₯Ί--lock-file-path <LOCK_FILE_PATH>β output location where the project lock file is written. by default, this isPROJECT_ROOT.lock.json.--locked-modeβ don't allow updating the project lock file. it's locked, it said what it said.--no-dependenciesβ when restoring a project with project-to-project (P2P) references, restores the root project and not the references.--no-http-cacheβ disable HTTP caching for packages.--osβ specifies the target operating system (OS). this is a shorthand syntax for setting the Runtime Identifier (RID), where the value you provide gets combined with the default RID. for example, on awin-x64machine, specifying--os linuxsets the RID tolinux-x64.
Introduced in .NET SDK 10.0.100
--packages <PACKAGES_DIRECTORY>β specifies the directory for restored packages.-r|--runtime <RUNTIME_IDENTIFIER>β specifies a runtime for the package restore. this is used to restore packages for runtimes that aren't explicitly listed in the<RuntimeIdentifiers>tag in the.csprojfile. for a list of Runtime Identifiers (RIDs), see the RID catalog.-s|--source <SOURCE>β specifies the URI of the NuGet package source to use during the restore operation. this setting overrides all of the sources specified in thenuget.configfiles. you can provide multiple sources by specifying this option multiple times. stack 'em up π--ucr|--use-current-runtimeβ use the current runtime as the target runtime.--use-lock-fileβ enables the project lock file to be generated and used with restore.--tl:[auto|on|off]β specifies whether Terminal Logger should be used for the build output. the default isauto, which first verifies the environment before enabling terminal logging. that environment check verifies the terminal is capable of using modern output features and isn't using a redirected standard output before enabling the new logger.onskips the environment check and enables terminal logging.offskips the environment check and uses the default console logger.
Terminal Logger shows you the restore phase followed by the build phase. during each phase, the currently building projects appear at the bottom of the terminal. each project that's building outputs both the MSBuild target currently being built and the amount of time spent on that target. you can search this info to learn more about the build. when a project is finished building, a single "build completed" section gets written that captures:
- the name of the built project.
- the target framework (if multi-targeted).
- the status of that build.
- the primary output of that build (which is hyperlinked).
- any diagnostics generated for that project.
this option is available starting in .NET 8.
-v|--verbosity <LEVEL>β sets the verbosity level of the command. allowed values areq[uiet],m[inimal],n[ormal],d[etailed], anddiag[nostic]. the default isminimal. for more info, see<xref:Microsoft.Build.Framework.LoggerVerbosity>.-?|-h|--helpβ prints out a description of how to use the command. the classic "help me help you" move π«Ά
okay bestie that's the first half of the vibe check β there's more where that came from, so don't go anywhere πβ¨
β¨ EXAMPLES β¨
okay bestie, here's the tea β real commands you can literally copy-paste π
- Restore dependencies and tools for the project in the current directory:
dotnet restore
- Restore dependencies and tools for the
app1project found in the given path:
dotnet restore ./projects/app1/app1.csproj
- Restore the dependencies and tools for the project in the current directory using the file path provided as the source:
dotnet restore -s c:\packages\mypackages
- Restore the dependencies and tools for the project in the current directory using the two file paths provided as sources:
dotnet restore -s c:\packages\mypackages -s c:\packages\myotherpackages
- Restore dependencies and tools for the project in the current directory showing detailed output:
dotnet restore --verbosity detailed
π Audit for security vulnerabilities π
Starting in .NET 8, dotnet restore comes with NuGet security auditing built in. Not me running a whole security audit without even being asked π This auditing produces a report of security vulnerabilities with the affected package name, the severity of the vulnerability, and a link to the advisory for more details. Receipts included, periodt.
Wanna opt out of the security auditing? Totally valid. Set the <NuGetAudit> MSBuild property to false in your project file. bye felicia π
To retrieve the known vulnerability dataset, make sure you have the NuGet.org central registry defined as one of your package sources:
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
You can also configure the level at which auditing will fail by setting the <NuGetAuditLevel> MSBuild property. Possible values are low, moderate, high, and critical. So for example, if you only want to see moderate, high, and critical advisories, you can set the property to moderate. vibe check your threat tolerance fr fr β οΈ
In .NET 8 and .NET 9, only direct package references are audited by default. Starting in .NET 10, NuGet audits both direct and transitive package references by default. glow up fr π You can change the mode by setting the <NuGetAuditMode> MSBuild property to direct or all.
For more information, see Auditing package dependencies for security vulnerabilities. go read it, iykyk πβ¨
and that's the whole page bestie!! you made it to the end, so proud of you π₯Ήπ
this slay of a manual page is from the dotnet-restore(1) source, dated 2025-10-30 β shoutout to the date stamp for keeping it iconic π
okay ily, now go restore something and hydrate π«ΆπΈπ¦
π¦ where this page comes from
- alpine 3.24: dotnet-doc 10.0.303-r2 Β· MIT
- centos-stream 10: dotnet-host 11.0.0~rc.2.26504.105-0.10.el10 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- centos-stream 9: dotnet-host 11.0.0~rc.2.26504.105-0.11.el9 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- fedora 43: dotnet-host 10.0.12-1.fc43
- fedora 43: dotnet-host 11.0.0~rc.1.26425.128-0.10.fc43 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- fedora 44: dotnet-host 10.0.12-1.fc44
- fedora 44: dotnet-host 10.0.4-1.fc44 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- fedora 44: dotnet-host 11.0.0~rc.1.26425.128-0.12.fc44 Β· 0BSD AND Apache-2.0 AND (Apache-2.0 WITH LLVM-exception) AND APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSL-1.0 AND bzip2-1.0.6 AND CC0-1.0 AND CC-BY-3.0 AND CC-BY-4.0 AND CC-PDDC AND CNRI-Python AND EPL-1.0 AND GPL-2.0-only AND (GPL-2.0-only WITH GCC-exception-2.0) AND GPL-2.0-or-later AND GPL-3.0-only AND ICU AND ISC AND LGPL-2.1-only AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND LicenseRef-ISO-8879 AND MIT AND MIT-Wu AND MS-PL AND MS-RL AND NCSA AND OFL-1.1 AND OpenSSL AND Unicode-DFS-2015 AND Unicode-DFS-2016 AND W3C-19980720 AND X11 AND Zlib
- nixpkgs unstable: dotnet-vmr 11.0.0-rc.3
- ubuntu noble: dotnet-host-10.0 10.0.12-0ubuntu1~24.04.1
- ubuntu questing: dotnet-host-10.0 10.0.9-0ubuntu1~25.10.1
- ubuntu resolute: dotnet-host-10.0 10.0.12-0ubuntu1~26.04.1
- ubuntu resolute: dotnet-host-10.0 10.0.5-0ubuntu1 Β· MIT
- ubuntu stonking: dotnet-host-10.0 10.0.12-0ubuntu2 Β· MIT
- ubuntu stonking: dotnet-host-11.0 11.0.0~rc1-0ubuntu1 Β· MIT
- ubuntu stonking: dotnet-host-11.0 11.0.0~rc3-0ubuntu1~26.10.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms