dotnet publish
all
Publish a .NET application and its dependencies to a directory for deployment to a hosting system.
More info →Options (4)
-c, --configurationbooleanCompile a .NET project in release mode
Example:
dotnet publish {{[-c|--configuration]}} Release {{path/to/project_file}}--self-containedbooleanPublish the .NET Core runtime with your application for the specified runtime
Example:
dotnet publish {{[-sc|--self-contained]}} true {{[-r|--runtime]}} {{runtime_identifier}} {{path/to/project_file}}-r, --runtimebooleanPublish the .NET Core runtime with your application for the specified runtime
Example:
dotnet publish {{[-sc|--self-contained]}} true {{[-r|--runtime]}} {{runtime_identifier}} {{path/to/project_file}}-o, --outputbooleanSpecify the output directory
Example:
dotnet publish {{[-o|--output]}} {{path/to/directory}} {{path/to/project_file}}Examples (6)
Compile a .NET project in release mode
dotnet publish [-c|--configuration] Release path/to/project_filePublish the .NET Core runtime with your application for the specified runtime
dotnet publish [-sc|--self-contained] true [-r|--runtime] runtime_identifier path/to/project_filePackage the application into a platform-specific single-file executable
dotnet publish [-r|--runtime] runtime_identifier -p:PublishSingleFile=true path/to/project_fileTrim unused libraries to reduce the deployment size of an application
dotnet publish [-sc|--self-contained] true [-r|--runtime] runtime_identifier -p:PublishTrimmed=true path/to/project_fileCompile a .NET project without restoring dependencies
dotnet publish --no-restore path/to/project_fileSpecify the output directory
dotnet publish [-o|--output] path/to/directory path/to/project_filemade by @shridhargupta | data from tldr-pages