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   nuget.config differences
46       The  behavior of the dotnet restore command is affected by the settings
47       in the nuget.config file, if present.  For example, setting the global‐
48       PackagesFolder  in  nuget.config  places the restored NuGet packages in
49       the specified folder.  This is an alternative to specifying the --pack‐
50       ages  option  on the dotnet restore command.  For more information, see
51       the nuget.config reference.
52
53       There are three specific settings that dotnet restore ignores:
54
55       · bindingRedirects
56
57         Binding redirects don’t work  with  <PackageReference>  elements  and
58         .NET  Core  only supports <PackageReference> elements for NuGet pack‐
59         ages.
60
61       · solution
62
63         This setting is Visual Studio specific  and  doesn’t  apply  to  .NET
64         Core.   .NET Core doesn’t use a packages.config file and instead uses
65         <PackageReference> elements for NuGet packages.
66
67       · trustedSigners
68
69         This setting isn’t applicable as NuGet  doesn’t  yet  support  cross-
70         platform verification of trusted packages.
71
72   Implicit dotnet restore
73       Starting with .NET Core 2.0, dotnet restore is run implicitly if neces‐
74       sary when you issue the following commands:
75
76       · dotnet new
77
78       · dotnet build
79
80       · dotnet build-server
81
82       · dotnet run
83
84       · dotnet test
85
86       · dotnet publish
87
88       · dotnet pack
89
90       In most cases, you no longer need to explicitly use the dotnet  restore
91       command.
92
93       Sometimes,  it  might be inconvenient to run dotnet restore implicitly.
94       For example, some automated systems, such as  build  systems,  need  to
95       call  dotnet  restore  explicitly to control when the restore occurs so
96       that they can control network usage.  To prevent  dotnet  restore  from
97       running implicitly, you can use the --no-restore flag with any of these
98       commands to disable implicit restore.
99
100   Arguments
101       ROOT
102
103       Optional path to the project file to restore.
104

OPTIONS

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

EXAMPLES

227       Restore dependencies and tools for the project in the current  directo‐
228       ry:
229
230       dotnet restore
231
232       Restore  dependencies and tools for the app1 project found in the given
233       path:
234
235       dotnet restore ~/projects/app1/app1.csproj
236
237       Restore the dependencies and tools for the project in the  current  di‐
238       rectory using the file path provided as the source:
239
240       dotnet restore -s c:\packages\mypackages
241
242       Restore  the  dependencies and tools for the project in the current di‐
243       rectory using the two file paths provided as sources:
244
245       dotnet restore -s c:\packages\mypackages -s c:\packages\myotherpackages
246
247       Restore dependencies and tools for the project in the current directory
248       showing detailed output:
249
250       dotnet restore --verbosity detailed
251
252
253
254                                                     dotnet restore command(1)
Impressum