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: documentation/general/dotnet-run-file.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,11 @@ For example, the remaining command-line arguments after the first argument (the
65
65
(except for the arguments recognized by `dotnet run` unless they are after the `--` separator)
66
66
and working directory is not changed (e.g., `cd /x/ && dotnet run /y/file.cs` runs the program in directory `/x/`).
67
67
68
-
`dotnet path.cs` is a shortcut for `dotnet run path.cs` provided that `path.cs` is a valid [target path](#target-path).
68
+
If a dash (`-`) is given instead of the target path (i.e., `dotnet run -`), the C# file to be executed is read from the standard input.
69
+
In this case, the current working directory is not used to search for other files (launch profiles, other sources in case of multi-file apps);
70
+
the compilation consists solely of the single file read from the standard input.
71
+
72
+
`dotnet path.cs` is a shortcut for `dotnet run path.cs` provided that `path.cs` is a valid [target path](#target-path) (`dotnet -` is currently not supported).
69
73
70
74
### Other commands
71
75
@@ -247,10 +251,6 @@ This section outlines potential future enhancements and alternatives considered.
247
251
248
252
We could allow folders as the target path in the future (e.g., `dotnet run ./my-app/`).
249
253
250
-
An option like `dotnet run --cs-from-stdin` could read the C# file from standard input.
251
-
In this case, the current working directory would not be used to search for project or other C# files;
252
-
the compilation would consist solely of the single file read from standard input.
253
-
254
254
Similarly, it could be possible to specify the whole C# source text in a command-line argument
255
255
like `dotnet run --cs-code 'Console.WriteLine("Hi")'`.
0 commit comments