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
+8-1Lines changed: 8 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,8 @@ Additionally, the implicit project file has the following customizations:
32
32
33
33
-`PublishAot` is set to `true`, see [`dotnet publish file.cs`](#other-commands) for more details.
34
34
35
+
-`PackAsTool` is set to `true`, see [`dotnet pack file.cs`](#other-commands) for more details.
36
+
35
37
-`UserSecretsId` is set to a hash of the entry point file path.
36
38
37
39
-[File-level directives](#directives-for-project-metadata) are applied.
@@ -103,7 +105,10 @@ If a dash (`-`) is given instead of the target path (i.e., `dotnet run -`), the
103
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);
104
106
the compilation consists solely of the single file read from the standard input.
105
107
106
-
`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).
108
+
`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
+
and it is not a DLL path, built-in command, or a NuGet tool (e.g., `dotnet watch` invokes the `dotnet-watch` tool
110
+
even if a valid `watch` file-based app exists in the current directory;
111
+
one can use `dotnet ./watch` to run the file-based app).
107
112
108
113
### Other commands
109
114
@@ -112,6 +117,8 @@ Commands `dotnet restore file.cs` and `dotnet build file.cs` are needed for IDE
112
117
Commands `dotnet publish file.cs` and `dotnet pack file.cs` are also supported for file-based programs.
113
118
Note that file-based apps have implicitly set `PublishAot=true`, so publishing uses Native AOT (and building reports AOT warnings).
114
119
To opt out, use `#:property PublishAot=false` directive in your `.cs` file.
120
+
Additionally, file-based apps have implicitly set `PackAsTool=true` because file-based apps are usually tools;
121
+
again, you can opt out via `#:property PackAsTool=false`.
115
122
116
123
Command `dotnet clean file.cs` can be used to clean build artifacts of the file-based program.
0 commit comments