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