dotnet publish

dotnet publish --help

eg@debian:~$ dotnet publish --help
Description:
  Publisher for the .NET Platform

Usage:
  dotnet publish [<PROJECT | SOLUTION>...] [options]

Arguments:
  <PROJECT | SOLUTION>  The project or solution file to operate on. If a file is not specified, the command will search the current directory for one.

Options:
  --ucr, --use-current-runtime         Use current runtime as the target runtime.
  -o, --output <OUTPUT_DIR>            The output directory to place the published artifacts in.
  --manifest <MANIFEST>                The path to a target manifest file that contains the list of packages to be excluded from the publish step.
  --no-build                           Do not build the project before publishing. Implies --no-restore.
  --sc, --self-contained               Publish the .NET runtime with your application so the runtime doesn't need to be installed on the target machine.
                                       The default is 'true' if a runtime identifier is specified.
  --no-self-contained                  Publish your application as a framework dependent application. A compatible .NET runtime must be installed on the target machine to run your 
                                       application.
  --nologo                             Do not display the startup banner or the copyright message.
  -f, --framework <FRAMEWORK>          The target framework to publish for. The target framework has to be specified in the project file.
  -r, --runtime <RUNTIME_IDENTIFIER>   The target runtime to publish for. This is used when creating a self-contained deployment.
                                       The default is to publish a framework-dependent application.
  -c, --configuration <CONFIGURATION>  The configuration to publish for. The default is 'Debug'. Use the `PublishRelease` property to make 'Release' the default for this command.
  --version-suffix <VERSION_SUFFIX>    Set the value of the $(VersionSuffix) property to use when building the project.
  --interactive                        Allows the command to stop and wait for user input or action (for example to complete authentication).
  --no-restore                         Do not restore the project before building.
  -v, --verbosity <LEVEL>              Set the MSBuild verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].
  -a, --arch <arch>                    The target architecture.
  --os <os>                            The target operating system.
  --disable-build-servers              Force the command to ignore any persistent build servers.
  -?, -h, --help                       Show command line help.

dotnet publish <project_file_path> --configuration <configuration_option>

eg@debian:~$ dotnet publish ./Data/DotnetCliExamples/ExampleSolution/ExampleSolution.ConsoleApp1/ExampleSolution.ConsoleApp1.csproj --configuration Release
MSBuild version 17.6.8+c70978d4d for .NET
  Determining projects to restore...
  Restored /home/eg/Data/DotnetCliExamples/ExampleSolution/ExampleSolution.ConsoleApp1/ExampleSolution.ConsoleApp1.csproj (in 58 ms).
  ExampleSolution.ConsoleApp1 -> /home/eg/Data/DotnetCliExamples/ExampleSolution/ExampleSolution.ConsoleApp1/bin/Release/net7.0/ExampleSolution.ConsoleApp1.dll
  ExampleSolution.ConsoleApp1 -> /home/eg/Data/DotnetCliExamples/ExampleSolution/ExampleSolution.ConsoleApp1/bin/Release/net7.0/publish/

Last updated