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
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,6 +104,9 @@ and working directory is not changed (e.g., `cd /x/ && dotnet run /y/file.cs` ru
104
104
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.
105
105
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);
106
106
the compilation consists solely of the single file read from the standard input.
107
+
However, the current working directory is still used as the working directory for building and executing the program.
108
+
To reference projects relative to the current working directory (instead of relative to the temporary directory the file is isolated in),
109
+
you can use something like `#:project $(MSBuildStartupDirectory)/relative/path`.
107
110
108
111
`dotnet path.cs` is a shortcut for `dotnet run --file path.cs` provided that `path.cs` is a valid [target path](#target-path) (`dotnet -` is currently not supported)
109
112
and it is not a DLL path, built-in command, or a NuGet tool (e.g., `dotnet watch` invokes the `dotnet-watch` tool
0 commit comments