1dotnet run command(1) .NET Core dotnet run command(1)
2
3
4
6 This article applies to: ✓ .NET Core 1.x SDK and later versions
7
9 dotnet run - Runs source code without any explicit compile or launch
10 commands.
11
13 .NET Core 3.0
14 dotnet run [-c|--configuration] [-f|--framework] [--force] [--interactive] [--launch-profile] [--no-build] [--no-dependencies]
15 [--no-launch-profile] [--no-restore] [-p|--project] [-r|--runtime] [-v|--verbosity] [[--] [application arguments]]
16 dotnet run [-h|--help]
17
18 .NET Core 2.1
19 dotnet run [-c|--configuration] [-f|--framework] [--force] [--launch-profile] [--no-build] [--no-dependencies]
20 [--no-launch-profile] [--no-restore] [-p|--project] [--runtime] [-v|--verbosity] [[--] [application arguments]]
21 dotnet run [-h|--help]
22
23 .NET Core 2.0
24 dotnet run [-c|--configuration] [-f|--framework] [--force] [--launch-profile] [--no-build] [--no-dependencies]
25 [--no-launch-profile] [--no-restore] [-p|--project] [--runtime] [[--] [application arguments]]
26 dotnet run [-h|--help]
27
28 .NET Core 1.x
29 dotnet run [-c|--configuration] [-f|--framework] [-p|--project] [[--] [application arguments]]
30 dotnet run [-h|--help]
31
32 * * * * *
33
35 The dotnet run command provides a convenient option to run your appli‐
36 cation from the source code with one command. It’s useful for fast it‐
37 erative development from the command line. The command depends on the
38 dotnet build command to build the code. Any requirements for the
39 build, such as that the project must be restored first, apply to dotnet
40 run as well.
41
42 Output files are written into the default location, which is bin/<con‐
43 figuration>/<target>. For example if you have a netcoreapp2.1 applica‐
44 tion and you run dotnet run, the output is placed in bin/Debug/netcore‐
45 app2.1. Files are overwritten as needed. Temporary files are placed
46 in the obj directory.
47
48 If the project specifies multiple frameworks, executing dotnet run re‐
49 sults in an error unless the -f|--framework <FRAMEWORK> option is used
50 to specify the framework.
51
52 The dotnet run command is used in the context of projects, not built
53 assemblies. If you’re trying to run a framework-dependent application
54 DLL instead, you must use dotnet without a command. For example, to
55 run myapp.dll, use:
56
57 dotnet myapp.dll
58
59 For more information on the dotnet driver, see the .NET Core Command
60 Line Tools (CLI) topic.
61
62 To run the application, the dotnet run command resolves the dependen‐
63 cies of the application that are outside of the shared runtime from the
64 NuGet cache. Because it uses cached dependencies, it’s not recommended
65 to use dotnet run to run applications in production. Instead, create a
66 deployment using the dotnet publish command and deploy the published
67 output.
68
70 .NET Core 3.0
71 --
72
73 Delimits arguments to dotnet run from arguments for the application be‐
74 ing run. All arguments after this delimiter are passed to the applica‐
75 tion run.
76
77 -c|--configuration {Debug|Release}
78
79 Defines the build configuration. The default value for most projects
80 is Debug.
81
82 -f|--framework <FRAMEWORK>
83
84 Builds and runs the app using the specified framework. The framework
85 must be specified in the project file.
86
87 --force
88
89 Forces all dependencies to be resolved even if the last restore was
90 successful. Specifying this flag is the same as deleting the
91 project.assets.json file.
92
93 -h|--help
94
95 Prints out a short help for the command.
96
97 --interactive
98
99 Allows the command to stop and wait for user input or action (for exam‐
100 ple, to complete authentication).
101
102 --launch-profile <NAME>
103
104 The name of the launch profile (if any) to use when launching the ap‐
105 plication. Launch profiles are defined in the launchSettings.json file
106 and are typically called Development, Staging, and Production. For
107 more information, see Working with multiple environments.
108
109 --no-build
110
111 Doesn’t build the project before running. It also implicit sets the
112 --no-restore flag.
113
114 --no-dependencies
115
116 When restoring a project with project-to-project (P2P) references, re‐
117 stores the root project and not the references.
118
119 --no-launch-profile
120
121 Doesn’t try to use launchSettings.json to configure the application.
122
123 --no-restore
124
125 Doesn’t execute an implicit restore when running the command.
126
127 -p|--project <PATH>
128
129 Specifies the path of the project file to run (folder name or full
130 path). If not specified, it defaults to the current directory.
131
132 --runtime <RUNTIME_IDENTIFIER>
133
134 Specifies the target runtime to restore packages for. For a list of
135 Runtime Identifiers (RIDs), see the RID catalog.
136
137 -v|--verbosity <LEVEL>
138
139 Sets the verbosity level of the command. Allowed values are q[uiet],
140 m[inimal], n[ormal], d[etailed], and diag[nostic].
141
142 .NET Core 2.1
143 --
144
145 Delimits arguments to dotnet run from arguments for the application be‐
146 ing run. All arguments after this delimiter are passed to the applica‐
147 tion run.
148
149 -c|--configuration {Debug|Release}
150
151 Defines the build configuration. The default value for most projects
152 is Debug.
153
154 -f|--framework <FRAMEWORK>
155
156 Builds and runs the app using the specified framework. The framework
157 must be specified in the project file.
158
159 --force
160
161 Forces all dependencies to be resolved even if the last restore was
162 successful. Specifying this flag is the same as deleting the
163 project.assets.json file.
164
165 -h|--help
166
167 Prints out a short help for the command.
168
169 --launch-profile <NAME>
170
171 The name of the launch profile (if any) to use when launching the ap‐
172 plication. Launch profiles are defined in the launchSettings.json file
173 and are typically called Development, Staging, and Production. For
174 more information, see Working with multiple environments.
175
176 --no-build
177
178 Doesn’t build the project before running. It also implicit sets the
179 --no-restore flag.
180
181 --no-dependencies
182
183 When restoring a project with project-to-project (P2P) references, re‐
184 stores the root project and not the references.
185
186 --no-launch-profile
187
188 Doesn’t try to use launchSettings.json to configure the application.
189
190 --no-restore
191
192 Doesn’t execute an implicit restore when running the command.
193
194 -p|--project <PATH>
195
196 Specifies the path of the project file to run (folder name or full
197 path). If not specified, it defaults to the current directory.
198
199 --runtime <RUNTIME_IDENTIFIER>
200
201 Specifies the target runtime to restore packages for. For a list of
202 Runtime Identifiers (RIDs), see the RID catalog.
203
204 -v|--verbosity <LEVEL>
205
206 Sets the verbosity level of the command. Allowed values are q[uiet],
207 m[inimal], n[ormal], d[etailed], and diag[nostic].
208
209 .NET Core 2.0
210 --
211
212 Delimits arguments to dotnet run from arguments for the application be‐
213 ing run. All arguments after this delimiter are passed to the applica‐
214 tion run.
215
216 -c|--configuration {Debug|Release}
217
218 Defines the build configuration. The default for most projects value
219 is Debug.
220
221 -f|--framework <FRAMEWORK>
222
223 Builds and runs the app using the specified framework. The framework
224 must be specified in the project file.
225
226 --force
227
228 Forces all dependencies to be resolved even if the last restore was
229 successful. Specifying this flag is the same as deleting the
230 project.assets.json file.
231
232 -h|--help
233
234 Prints out a short help for the command.
235
236 --launch-profile <NAME>
237
238 The name of the launch profile (if any) to use when launching the ap‐
239 plication. Launch profiles are defined in the launchSettings.json file
240 and are typically called Development, Staging, and Production. For
241 more information, see Working with multiple environments.
242
243 --no-build
244
245 Doesn’t build the project before running. It also implicit sets the
246 --no-restore flag.
247
248 --no-dependencies
249
250 When restoring a project with project-to-project (P2P) references, re‐
251 stores the root project and not the references.
252
253 --no-launch-profile
254
255 Doesn’t try to use launchSettings.json to configure the application.
256
257 --no-restore
258
259 Doesn’t execute an implicit restore when running the command.
260
261 -p|--project <PATH>
262
263 Specifies the path of the project file to run (folder name or full
264 path). If not specified, it defaults to the current directory.
265
266 --runtime <RUNTIME_IDENTIFIER>
267
268 Specifies the target runtime to restore packages for. For a list of
269 Runtime Identifiers (RIDs), see the RID catalog.
270
271 .NET Core 1.x
272 --
273
274 Delimits arguments to dotnet run from arguments for the application be‐
275 ing run. All arguments after this delimiter are passed to the applica‐
276 tion run.
277
278 -c|--configuration {Debug|Release}
279
280 Defines the build configuration. The default value for most projects
281 is Debug.
282
283 -f|--framework <FRAMEWORK>
284
285 Builds and runs the app using the specified framework. The framework
286 must be specified in the project file.
287
288 -h|--help
289
290 Prints out a short help for the command.
291
292 -p|--project <PATH/PROJECT.csproj>
293
294 Specifies the path and name of the project file. (See the NOTE.) If
295 not specified, it defaults to the current directory.
296
297 [!NOTE] Use the path and name of the project file with the
298 -p|--project option. A regression in the CLI prevents providing
299 a folder path with .NET Core SDK 1.x. For more information
300 about this issue, see dotnet run -p, can not start a project
301 (dotnet/cli #5992).
302
303 * * * * *
304
306 Run the project in the current directory:
307
308 dotnet run
309
310 Run the specified project:
311
312 dotnet run --project ./projects/proj1/proj1.csproj
313
314 Run the project in the current directory (the --help argument in this
315 example is passed to the application, since the blank -- option is
316 used):
317
318 dotnet run --configuration Release -- --help
319
320 Restore dependencies and tools for the project in the current directory
321 only showing minimal output and then run the project: (.NET Core SDK
322 2.0 and later versions):
323
324 dotnet run --verbosity m
325
326
327
328 dotnet run command(1)