You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/core/tools/dotnet-run.md
+17-3Lines changed: 17 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,6 +58,8 @@ To run the application, the `dotnet run` command resolves the dependencies of th
58
58
`<applicationArguments>`
59
59
60
60
Arguments passed to the application that is being run.
61
+
62
+
Any arguments that aren't recognized by `dotnet run` are passed to the application. To separate arguments for `dotnet run` from arguments for the application, use the `--` option.
61
63
62
64
## Options
63
65
@@ -83,7 +85,7 @@ To run the application, the `dotnet run` command resolves the dependencies of th
83
85
84
86
-**`--file <FILE_PATH>`**
85
87
86
-
The path to the file-based app to run. This option can be passed as the first argument if there is no project in the current directory. For more information, see [Build file-based C# apps](/dotnet/csharp/fundamentals/tutorials/file-based-programs).
88
+
The path to the file-based app to run. If a path isn't specified, the current directory is used to find and run the file. For more information on file-based apps, see [Build file-based C# apps](/dotnet/csharp/fundamentals/tutorials/file-based-programs).
87
89
88
90
On Unix, you can run file-based apps directly, using the source file name on the command line instead of `dotnet run`. First, ensure the file has execute permissions. Then, add a shebang line `#!` as the first line of the file, for example:
89
91
@@ -179,10 +181,10 @@ The environment is constructed in the same order as this list, so the `-e|--envi
179
181
dotnet run
180
182
```
181
183
182
-
- Run the specified file-based app with arguments:
184
+
- Run the specified file-based app in the current directory:
183
185
184
186
```dotnetcli
185
-
dotnet run ConsoleApp.cs -- arg1 arg2
187
+
dotnet run --file ConsoleApp.cs
186
188
```
187
189
188
190
File-based app support was added in .NET SDK 10.0.100.
@@ -210,3 +212,15 @@ The environment is constructed in the same order as this list, so the `-e|--envi
210
212
```dotnetcli
211
213
dotnet run --verbosity m
212
214
```
215
+
216
+
- Run the project in the current directory using the specified framework and pass arguments to the application:
217
+
218
+
```dotnetcli
219
+
dotnet run -f net6.0 -- arg1 arg2
220
+
```
221
+
222
+
In the following example, three arguments are passed to the application. One argument is passed using `-`, and two arguments are passed after `--`:
Copy file name to clipboardExpand all lines: includes/cli-arguments-project-solution-file.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ ms.topic: include
5
5
6
6
`PROJECT | SOLUTION | FILE`
7
7
8
-
The project or solution or C# (file-based app) file to clean. If a file isn't specified, MSBuild searches the current directory for a project or solution.
8
+
The project or solution or C# (file-based app) file to operate on. If a file isn't specified, MSBuild searches the current directory for a project or solution.
9
9
10
10
-`PROJECT` is 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.
0 commit comments