dotnet publish create deployable output
Context: dotnet publish produces a folder ready for deployment. With .NET 10, you can publish as framework-dependent, self-contained, or single-file.
dotnet publish compiles the application and produces a folder containing everything needed for deployment.
Basic Usage
Section titled “Basic Usage”# Create publish output (Release configuration)dotnet publish
# Publish to specific directorydotnet publish -o ./publish
# Publish as self-contained (includes runtime)dotnet publish --self-contained trueDeployment Modes
Section titled “Deployment Modes”| Mode | Command | Output Size |
|---|---|---|
| Framework-dependent | dotnet publish | Small (requires runtime) |
| Self-contained | dotnet publish --self-contained true | Large (includes runtime) |
| Single-file | dotnet publish -p:PublishSingleFile=true | One .exe file |
# Single-file executabledotnet publish -p:PublishSingleFile=true -o ./publish
# Trim unused assembliesdotnet publish -p:PublishTrimmed=truePublish Output
Section titled “Publish Output”- For Windows: .exe and .dll files
- For Linux/macOS: executable file and .dll files