Skip to content

Commit 9907208

Browse files
authored
add file based changes for dotnet build
1 parent 01610b6 commit 9907208

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

docs/core/tools/dotnet-build.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
title: dotnet build command
33
description: The dotnet build command builds a project and all of its dependencies.
4-
ms.date: 11/27/2023
4+
ms.date: 09/24/2025
55
---
66
# dotnet build
77

8-
**This article applies to:** ✔️ .NET Core 3.1 SDK and later versions
8+
**This article applies to:** ✔️ .NET 6 and later versions
99

1010
## Name
1111

@@ -14,7 +14,7 @@ ms.date: 11/27/2023
1414
## Synopsis
1515

1616
```dotnetcli
17-
dotnet build [<PROJECT>|<SOLUTION>] [-a|--arch <ARCHITECTURE>]
17+
dotnet build [<PROJECT>|<SOLUTION>|<FILE>] [-a|--arch <ARCHITECTURE>]
1818
[--artifacts-path <ARTIFACTS_DIR>]
1919
[-c|--configuration <CONFIGURATION>] [-f|--framework <FRAMEWORK>]
2020
[--disable-build-servers]
@@ -23,7 +23,7 @@ dotnet build [<PROJECT>|<SOLUTION>] [-a|--arch <ARCHITECTURE>]
2323
[-o|--output <OUTPUT_DIRECTORY>]
2424
[-p|--property:<PROPERTYNAME>=<VALUE>]
2525
[-r|--runtime <RUNTIME_IDENTIFIER>]
26-
[--self-contained [true|false]] [--source <SOURCE>]
26+
[-sc|--self-contained [true|false]] [--source <SOURCE>]
2727
[--tl:[auto|on|off]] [--use-current-runtime, --ucr [true|false]]
2828
[-v|--verbosity <LEVEL>] [--version-suffix <VERSION_SUFFIX>]
2929
@@ -77,9 +77,9 @@ Running `dotnet build` is equivalent to running `dotnet msbuild -restore`; howev
7777

7878
## Arguments
7979

80-
`PROJECT | SOLUTION`
80+
`PROJECT | SOLUTION | FILE`
8181

82-
The project or solution file to build. If a project or solution file isn't specified, MSBuild searches the current working directory for a file that has a file extension that ends in either *proj* or *sln* and uses that file.
82+
The project or solution or C# (file-based program) file to build. If a file isn't specified, MSBuild searches the current directory for a project or solution.
8383

8484
## Options
8585

@@ -176,6 +176,12 @@ The project or solution file to build. If a project or solution file isn't speci
176176
dotnet build
177177
```
178178

179+
- Build a specific project file:
180+
181+
```dotnetcli
182+
dotnet build MyProject.cs
183+
```
184+
179185
- Build a project and its dependencies using Release configuration:
180186

181187
```dotnetcli

0 commit comments

Comments
 (0)