1dotnet restore command(1)          .NET Core         dotnet restore command(1)
2
3
4

dotnet restore

NAME

7       dotnet restore - Restores the dependencies and tools of a project.
8

SYNOPSIS

10   .NET Core 2.x
11              dotnet restore [<ROOT>] [--configfile] [--disable-parallel] [--force] [--ignore-failed-sources] [--no-cache]
12                  [--no-dependencies] [--packages] [-r|--runtime] [-s|--source] [-v|--verbosity] [--interactive]
13              dotnet restore [-h|--help]
14
15   .NET Core 1.x
16              dotnet restore [<ROOT>] [--configfile] [--disable-parallel] [--ignore-failed-sources] [--no-cache]
17                  [--no-dependencies] [--packages] [-r|--runtime] [-s|--source] [-v|--verbosity]
18              dotnet restore [-h|--help]
19
20          *   *   *   *   *
21

DESCRIPTION

23       The  dotnet  restore command uses NuGet to restore dependencies as well
24       as project-specific tools that are specified in the project  file.   By
25       default, the restoration of dependencies and tools are executed in par‐
26       allel.
27
28       To restore the dependencies, NuGet needs the feeds where  the  packages
29       are  located.  Feeds are usually provided via the NuGet.config configu‐
30       ration file.  A default configuration file is  provided  when  the  CLI
31       tools are installed.  You specify additional feeds by creating your own
32       NuGet.config file in the project directory.  You also specify addition‐
33       al feeds per invocation at a command prompt.
34
35       For  dependencies,  you  specify where the restored packages are placed
36       during the restore operation using the  --packages  argument.   If  not
37       specified,  the  default NuGet package cache is used, which is found in
38       the .nuget/packages directory in the user’s home directory on all oper‐
39       ating systems.  For example, /home/user1 on Linux or C:1 on Windows.
40
41       For project-specific tooling, dotnet restore first restores the package
42       in which the tool is packed, and then proceeds to  restore  the  tool’s
43       dependencies as specified in its project file.
44
45       The  behavior  of the dotnet restore command is affected by some of the
46       settings in the Nuget.Config file, if present.   For  example,  setting
47       the  globalPackagesFolder  in  NuGet.Config  places  the restored NuGet
48       packages in the specified folder.  This is an alternative to specifying
49       the --packages option on the dotnet restore command.  For more informa‐
50       tion, see the NuGet.Config reference.
51
52   Implicit dotnet restore
53       Starting with .NET Core 2.0, dotnet restore is run implicitly if neces‐
54       sary when you issue the following commands:
55
56       · dotnet new
57
58       · dotnet build
59
60       · dotnet build-server
61
62       · dotnet run
63
64       · dotnet test
65
66       · dotnet publish
67
68       · dotnet pack
69
70       In  most cases, you no longer need to explicitly use the dotnet restore
71       command.
72
73       Sometimes, it might be inconvenient to run dotnet  restore  implicitly.
74       For  example,  some  automated  systems, such as build systems, need to
75       call dotnet restore explicitly to control when the  restore  occurs  so
76       that  they  can  control network usage.  To prevent dotnet restore from
77       running implicitly, you can use the --no-restore flag with any of these
78       commands to disable implicit restore.
79
80   Arguments
81       ROOT
82
83       Optional path to the project file to restore.
84

OPTIONS

86   .NET Core 2.x
87       --configfile <FILE>
88
89       The  NuGet configuration file (NuGet.config) to use for the restore op‐
90       eration.
91
92       --disable-parallel
93
94       Disables restoring multiple projects in parallel.
95
96       --force
97
98       Forces all dependencies to be resolved even if  the  last  restore  was
99       successful.    Specifying  this  flag  is  the  same  as  deleting  the
100       project.assets.json file.
101
102       -h|--help
103
104       Prints out a short help for the command.
105
106       --ignore-failed-sources
107
108       Only warn about failed sources if there are packages meeting  the  ver‐
109       sion requirement.
110
111       --no-cache
112
113       Specifies to not cache packages and HTTP requests.
114
115       --no-dependencies
116
117       When  restoring a project with project-to-project (P2P) references, re‐
118       stores the root project and not the references.
119
120       --packages <PACKAGES_DIRECTORY>
121
122       Specifies the directory for restored packages.
123
124       -r|--runtime <RUNTIME_IDENTIFIER>
125
126       Specifies a runtime for the package restore.  This is used  to  restore
127       packages for runtimes not explicitly listed in the <RuntimeIdentifiers>
128       tag in the .csproj file.  For a list of Runtime Identifiers (RIDs), see
129       the  RID catalog.  Provide multiple RIDs by specifying this option mul‐
130       tiple times.
131
132       -s|--source <SOURCE>
133
134       Specifies a NuGet package source to use during the  restore  operation.
135       This setting overrides all of the sources specified in the NuGet.config
136       files.  Multiple sources can be provided by specifying this option mul‐
137       tiple times.
138
139       --verbosity <LEVEL>
140
141       Sets  the  verbosity level of the command.  Allowed values are q[uiet],
142       m[inimal], n[ormal], d[etailed], and diag[nostic].
143
144       --interactive
145
146       Allows the command to stop and wait for user input or action (for exam‐
147       ple to complete authentication).  Since .NET Core 2.1.400.
148
149   .NET Core 1.x
150       --configfile <FILE>
151
152       The  NuGet configuration file (NuGet.config) to use for the restore op‐
153       eration.
154
155       --disable-parallel
156
157       Disables restoring multiple projects in parallel.
158
159       -h|--help
160
161       Prints out a short help for the command.
162
163       --ignore-failed-sources
164
165       Only warn about failed sources if there are packages meeting  the  ver‐
166       sion requirement.
167
168       --no-cache
169
170       Specifies to not cache packages and HTTP requests.
171
172       --no-dependencies
173
174       When  restoring a project with project-to-project (P2P) references, re‐
175       stores the root project and not the references.
176
177       --packages <PACKAGES_DIRECTORY>
178
179       Specifies the directory for restored packages.
180
181       -r|--runtime <RUNTIME_IDENTIFIER>
182
183       Specifies a runtime for the package restore.  This is used  to  restore
184       packages for runtimes not explicitly listed in the <RuntimeIdentifiers>
185       tag in the .csproj file.  For a list of Runtime Identifiers (RIDs), see
186       the  RID catalog.  Provide multiple RIDs by specifying this option mul‐
187       tiple times.
188
189       -s|--source <SOURCE>
190
191       Specifies a NuGet package source to use during the  restore  operation.
192       This  overrides all of the sources specified in the NuGet.config files.
193       Multiple sources can be provided by  specifying  this  option  multiple
194       times.
195
196       --verbosity <LEVEL>
197
198       Sets  the  verbosity level of the command.  Allowed values are q[uiet],
199       m[inimal], n[ormal], d[etailed], and diag[nostic].
200
201          *   *   *   *   *
202

EXAMPLES

204       Restore dependencies and tools for the project in the current  directo‐
205       ry:
206
207       dotnet restore
208
209       Restore  dependencies and tools for the app1 project found in the given
210       path:
211
212       dotnet restore ~/projects/app1/app1.csproj
213
214       Restore the dependencies and tools for the project in the  current  di‐
215       rectory using the file path provided as the source:
216
217       dotnet restore -s c:\packages\mypackages
218
219       Restore  the  dependencies and tools for the project in the current di‐
220       rectory using the two file paths provided as sources:
221
222       dotnet restore -s c:\packages\mypackages -s c:\packages\myotherpackages
223
224       Restore dependencies and tools for the project in the current directory
225       and shows only minimal output:
226
227       dotnet restore --verbosity minimal
228
229
230
231                                                     dotnet restore command(1)
Impressum