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:
@@ -44,10 +44,19 @@ Only the outputs created during the build are cleaned.
44
44
Both intermediate (\f[I]obj\f[R]) and final output (\f[I]bin\f[R]) folders are cleaned.
45
45
.SH ARGUMENTS
46
46
.PP
47
-
\f[V]PROJECT | SOLUTION\f[R]
47
+
\f[V]PROJECT | SOLUTION | FILE\f[R]
48
48
.PP
49
-
The MSBuild project or solution to clean.
50
-
If a project or solution file is not specified, MSBuild searches the current working directory for a file that has a file extension that ends in \f[I]proj\f[R] or \f[I]sln\f[R], and uses that file.
49
+
The project or solution or C# (file-based app) file to operate on.
50
+
If a file isn\[cq]t specified, MSBuild searches the current directory for a project or solution.
51
+
.IP\[bu]2
52
+
\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.
53
+
.IP\[bu]2
54
+
\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.
55
+
.IP\[bu]2
56
+
\f[V]FILE\f[R] is an argument added in .NET 10.
57
+
The path and filename of a file-based app.
58
+
File-based apps are contained within a single file that is built and run without a corresponding project (\f[I].csproj\f[R]) file.
59
+
For more information, see Build file-based C# apps.
@@ -119,13 +128,13 @@ This is used when a self-contained deployment was created.
119
128
\f[B]\f[VB]--tl:[auto|on|off]\f[B]\f[R]
120
129
.RS2
121
130
.PP
122
-
Specifies whether the \f[I]terminallogger\f[R] should be used for the build output.
131
+
Specifies whether \f[I]TerminalLogger\f[R] should be used for the build output.
123
132
The default is \f[V]auto\f[R], which first verifies the environment before enabling terminal logging.
124
133
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.
125
134
\f[V]on\f[R] skips the environment check and enables terminal logging.
126
135
\f[V]off\f[R] skips the environment check and uses the default console logger.
127
136
.PP
128
-
The terminal logger shows you the restore phase followed by the build phase.
137
+
Terminal Logger shows you the restore phase followed by the build phase.
129
138
During each phase, the currently building projects appear at the bottom of the terminal.
130
139
Each project that\[cq]s building outputs both the MSBuild target currently being built and the amount of time spent on that target.
131
140
You can search this information to learn more about the build.
@@ -164,6 +173,18 @@ dotnet clean
164
173
.fi
165
174
.RE
166
175
.IP\[bu]2
176
+
Clean a file-based program:
177
+
.RS2
178
+
.IP
179
+
.nf
180
+
\f[C]
181
+
dotnet clean Program.cs.
182
+
\f[R]
183
+
.fi
184
+
.PP
185
+
File-based app support was added in .NET SDK 10.0.100.
186
+
.RE
187
+
.IP\[bu]2
167
188
Clean a project built using the Release configuration:
@@ -202,13 +202,13 @@ For more information, see .NET Blog: .NET Framework 4.5.1 Supports Microsoft Sec
202
202
\f[B]\f[VB]--tl:[auto|on|off]\f[B]\f[R]
203
203
.RS2
204
204
.PP
205
-
Specifies whether the \f[I]terminallogger\f[R] should be used for the build output.
205
+
Specifies whether \f[I]TerminalLogger\f[R] should be used for the build output.
206
206
The default is \f[V]auto\f[R], which first verifies the environment before enabling terminal logging.
207
207
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.
208
208
\f[V]on\f[R] skips the environment check and enables terminal logging.
209
209
\f[V]off\f[R] skips the environment check and uses the default console logger.
210
210
.PP
211
-
The terminal logger shows you the restore phase followed by the build phase.
211
+
Terminal Logger shows you the restore phase followed by the build phase.
212
212
During each phase, the currently building projects appear at the bottom of the terminal.
213
213
Each project that\[cq]s building outputs both the MSBuild target currently being built and the amount of time spent on that target.
214
214
You can search this information to learn more about the build.
@@ -172,18 +172,20 @@ When you run this command, it initiates an asynchronous background download of a
172
172
If the download is still running when this command finishes, the download is stopped.
173
173
For more information, see Advertising manifests.
174
174
.SH ARGUMENTS
175
-
.IP\[bu]2
176
-
\f[B]\f[VB]PROJECT|SOLUTION\f[B]\f[R]
177
-
.RS2
178
175
.PP
179
-
The project or solution to publish.
176
+
\f[V]PROJECT | SOLUTION | FILE\f[R]
177
+
.PP
178
+
The project or solution or C# (file-based app) file to operate on.
179
+
If a file isn\[cq]t specified, MSBuild searches the current directory for a project or solution.
180
180
.IP\[bu]2
181
181
\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.
182
-
If the directory is not specified, it defaults to the current directory.
183
182
.IP\[bu]2
184
183
\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.
185
-
If the directory is not specified, it defaults to the current directory.
186
-
.RE
184
+
.IP\[bu]2
185
+
\f[V]FILE\f[R] is an argument added in .NET 10.
186
+
The path and filename of a file-based app.
187
+
File-based apps are contained within a single file that is built and run without a corresponding project (\f[I].csproj\f[R]) file.
188
+
For more information, see Build file-based C# apps.
187
189
.SH OPTIONS
188
190
.IP\[bu]2
189
191
\f[B]\f[VB]-a|--arch <ARCHITECTURE>\f[B]\f[R]
@@ -320,15 +322,6 @@ If you specify a relative path when publishing a solution, all output for all pr
320
322
To make publish output go to separate folders for each project, specify a relative path by using the msbuild \f[V]PublishDir\f[R] property instead of the \f[V]--output\f[R] option.
321
323
For example, \f[V]dotnet publish -p:PublishDir=.\[rs]publish\f[R] sends publish output for each project to a \f[V]publish\f[R] folder under the folder that contains the project file.
322
324
.RE
323
-
.IP\[bu]2
324
-
\&.NET Core 2.x SDK
325
-
.RS2
326
-
.PP
327
-
If you specify a relative path when publishing a project, the generated output directory is relative to the project file location, not to the current working directory.
328
-
.PP
329
-
If you specify a relative path when publishing a solution, each project\[cq]s output goes into a separate folder relative to the project file location.
330
-
If you specify an absolute path when publishing a solution, all publish output for all projects goes into the specified folder.
331
-
.RE
332
325
.RE
333
326
.IP\[bu]2
334
327
\f[B]\f[VB]--os <OS>\f[B]\f[R]
@@ -376,13 +369,13 @@ If you use this option, use \f[V]--self-contained\f[R] or \f[V]--no-self-contain
376
369
\f[B]\f[VB]--tl:[auto|on|off]\f[B]\f[R]
377
370
.RS2
378
371
.PP
379
-
Specifies whether the \f[I]terminallogger\f[R] should be used for the build output.
372
+
Specifies whether \f[I]TerminalLogger\f[R] should be used for the build output.
380
373
The default is \f[V]auto\f[R], which first verifies the environment before enabling terminal logging.
381
374
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.
382
375
\f[V]on\f[R] skips the environment check and enables terminal logging.
383
376
\f[V]off\f[R] skips the environment check and uses the default console logger.
384
377
.PP
385
-
The terminal logger shows you the restore phase followed by the build phase.
378
+
Terminal Logger shows you the restore phase followed by the build phase.
386
379
During each phase, the currently building projects appear at the bottom of the terminal.
387
380
Each project that\[cq]s building outputs both the MSBuild target currently being built and the amount of time spent on that target.
388
381
You can search this information to learn more about the build.
0 commit comments