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
The \f[V]dotnet build\f[R] command builds the project and its dependencies into a set of binaries.
47
+
The \f[V]dotnet build\f[R] command builds the project, solution, or file-based app and its dependencies into a set of binaries.
48
48
The binaries include the project\[cq]s code in Intermediate Language (IL) files with a \f[I].dll\f[R] extension.
49
49
Depending on the project type and settings, other files may be included, such as:
50
50
.IP\[bu]2
51
-
An executable that can be used to run the application, if the project type is an executable targeting .NET Core 3.0 or later.
51
+
An executable that can be used to run the application.
52
52
.IP\[bu]2
53
53
Symbol files used for debugging with a \f[I].pdb\f[R] extension.
54
54
.IP\[bu]2
@@ -58,12 +58,6 @@ A \f[I].runtimeconfig.json\f[R] file, which specifies the shared runtime and its
58
58
.IP\[bu]2
59
59
Other libraries that the project depends on (via project references or NuGet package references).
60
60
.PP
61
-
For executable projects targeting versions earlier than .NET Core 3.0, library dependencies from NuGet are typically NOT copied to the output folder.
62
-
They\[cq]re resolved from the NuGet global packages folder at run time.
63
-
With that in mind, the product of \f[V]dotnet build\f[R] isn\[cq]t ready to be transferred to another machine to run.
64
-
To create a version of the application that can be deployed, you need to publish it (for example, with the dotnet publish command).
65
-
For more information, see .NET Application Deployment.
66
-
.PP
67
61
For executable projects targeting .NET Core 3.0 and later, library dependencies are copied to the output folder.
68
62
This means that if there isn\[cq]t any other publish-specific logic (such as Web projects have), the build output should be deployable.
69
63
.SS Implicit restore
@@ -98,7 +92,8 @@ To produce a library, omit the \f[V]<OutputType>\f[R] property or change its val
98
92
The IL DLL for a library doesn\[cq]t contain entry points and can\[cq]t be executed.
99
93
.SS MSBuild
100
94
.PP
101
-
\f[V]dotnet build\f[R] uses MSBuild to build the project, so it supports both parallel and incremental builds.
95
+
\f[V]dotnet build\f[R] uses MSBuild to build the project, solution, or file-based app.
96
+
It supports both parallel and incremental builds.
102
97
For more information, see Incremental Builds.
103
98
.PP
104
99
In addition to its options, the \f[V]dotnet build\f[R] command accepts MSBuild options, such as \f[V]-p\f[R] for setting properties or \f[V]-l\f[R] to define a logger.
@@ -117,10 +112,19 @@ If the download is still running when this command finishes, the download is sto
117
112
For more information, see Advertising manifests.
118
113
.SH ARGUMENTS
119
114
.PP
120
-
\f[V]PROJECT | SOLUTION\f[R]
115
+
\f[V]PROJECT | SOLUTION | FILE\f[R]
121
116
.PP
122
-
The project or solution file to build.
123
-
If a project or solution file isn\[cq]t specified, MSBuild searches the current working directory for a file that has a file extension that ends in either \f[I]proj\f[R] or \f[I]sln\f[R] and uses that file.
117
+
The project or solution or C# (file-based app) file to operate on.
118
+
If a file isn\[cq]t specified, MSBuild searches the current directory for a project or solution.
119
+
.IP\[bu]2
120
+
\f[V]PROJECT\f[R] 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.
121
+
.IP\[bu]2
122
+
\f[V]SOLUTION\f[R] is the path and filename of a solution file (\f[I].sln\f[R] or \f[I].slnx\f[R] extension), or the path to a directory that contains a solution file.
123
+
.IP\[bu]2
124
+
\f[V]FILE\f[R] is an argument added in .NET 10.
125
+
The path and filename of a file-based app.
126
+
File-based apps are contained within a single file that is built and run without a corresponding project (\f[I].csproj\f[R]) file.
127
+
For more information, see Build file-based C# apps.
124
128
.SH OPTIONS
125
129
.IP\[bu]2
126
130
\f[B]\f[VB]-a|--arch <ARCHITECTURE>\f[B]\f[R]
@@ -285,13 +289,13 @@ The URI of the NuGet package source to use during the restore operation.
285
289
\f[B]\f[VB]--tl:[auto|on|off]\f[B]\f[R]
286
290
.RS2
287
291
.PP
288
-
Specifies whether the \f[I]terminallogger\f[R] should be used for the build output.
292
+
Specifies whether \f[I]TerminalLogger\f[R] should be used for the build output.
289
293
The default is \f[V]auto\f[R], which first verifies the environment before enabling terminal logging.
290
294
The environment check verifies that the terminal is capable of using modern output features and isn\[cq]t using a redirected standard output before enabling the new logger.
291
295
\f[V]on\f[R] skips the environment check and enables terminal logging.
292
296
\f[V]off\f[R] skips the environment check and uses the default console logger.
293
297
.PP
294
-
The terminal logger shows you the restore phase followed by the build phase.
298
+
Terminal Logger shows you the restore phase followed by the build phase.
295
299
During each phase, the currently building projects appear at the bottom of the terminal.
296
300
Each project that\[cq]s building outputs both the MSBuild target currently being built and the amount of time spent on that target.
297
301
You can search this information to learn more about the build.
@@ -348,6 +352,18 @@ dotnet build
348
352
.fi
349
353
.RE
350
354
.IP\[bu]2
355
+
Build a file-based app:
356
+
.RS2
357
+
.IP
358
+
.nf
359
+
\f[C]
360
+
dotnet build MyProject.cs
361
+
\f[R]
362
+
.fi
363
+
.PP
364
+
File-based app support was added in .NET SDK 10.0.100.
365
+
.RE
366
+
.IP\[bu]2
351
367
Build a project and its dependencies using Release configuration:
0 commit comments