Skip to content

Commit bc4764f

Browse files
authored
add file-based app details for dotnet publish
1 parent b0fa169 commit bc4764f

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

docs/core/tools/dotnet-publish.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
title: dotnet publish command
33
description: The dotnet publish command publishes a .NET project or solution to a directory.
4-
ms.date: 01/07/2025
4+
ms.date: 09/24/2025
55
---
66
# dotnet publish
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: 01/07/2025
1414
## Synopsis
1515

1616
```dotnetcli
17-
dotnet publish [<PROJECT>|<SOLUTION>] [-a|--arch <ARCHITECTURE>]
17+
dotnet publish [<PROJECT>|<SOLUTION>|<FILE>] [-a|--arch <ARCHITECTURE>]
1818
[--artifacts-path <ARTIFACTS_DIR>]
1919
[-c|--configuration <CONFIGURATION>] [--disable-build-servers]
2020
[-f|--framework <FRAMEWORK>] [--force] [--interactive]
@@ -114,14 +114,16 @@ For more information, see the following resources:
114114

115115
## Arguments
116116

117-
- **`PROJECT|SOLUTION`**
117+
`PROJECT | SOLUTION | FILE`
118118

119-
The project or solution to publish.
119+
The project or solution or C# (file-based program) file to operate on. If a file isn't specified, MSBuild searches the current directory for a project or solution.
120120

121121
* `PROJECT` 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. If the directory is not specified, it defaults to the current directory.
122122

123123
* `SOLUTION` is the path and filename of a solution file (*.sln* or *.slnx* extension), or the path to a directory that contains a solution file. If the directory is not specified, it defaults to the current directory.
124124

125+
* `FILE` is the path and filename of a file-based app. Files-based apps are programs contained within a single `*.cs` file that are built and run without a corresponding project (`*.csproj`) file. For more information, see [Build file-based C# programs](/dotnet/csharp/fundamentals/tutorials/file-based-programs).
126+
125127
## Options
126128

127129
[!INCLUDE [arch](../../../includes/cli-arch.md)]
@@ -268,6 +270,12 @@ For more information, see the following resources:
268270
dotnet publish --no-dependencies
269271
```
270272

273+
- Publish the file-based C# program *app.cs* in the current directory:
274+
275+
```dotnetcli
276+
dotnet publish app.cs
277+
```
278+
271279
## See also
272280

273281
- [.NET application publishing overview](../deploying/index.md)

0 commit comments

Comments
 (0)