Skip to content

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.

Terminal window
# Create publish output (Release configuration)
dotnet publish
# Publish to specific directory
dotnet publish -o ./publish
# Publish as self-contained (includes runtime)
dotnet publish --self-contained true
ModeCommandOutput Size
Framework-dependentdotnet publishSmall (requires runtime)
Self-containeddotnet publish --self-contained trueLarge (includes runtime)
Single-filedotnet publish -p:PublishSingleFile=trueOne .exe file
Terminal window
# Single-file executable
dotnet publish -p:PublishSingleFile=true -o ./publish
# Trim unused assemblies
dotnet publish -p:PublishTrimmed=true
  • For Windows: .exe and .dll files
  • For Linux/macOS: executable file and .dll files