---
title: "dotnet publish"
---
Publishes a .NET Core/Framework/Standard project using dotnet publish.
DotNet::Publish(
[SelfContained: <true/false>],
Project: <text>,
[Configuration: <text>],
[PackageSource: <text>],
[Version: <text>],
[Framework: <text>],
[Runtime: <text>],
[Output: <text>],
[VSToolsPath: <text>],
[ForceDependencyResolution: <true/false>],
[Verbosity: <integer>],
[ContinuousIntegrationBuild: <true/false>],
[ImageBasedService: <text>],
[AdditionalArguments: <text>],
[EnsureDotNetInstalled: <text>],
[DotNetPath: <text>]
);
Name | Format | Script Usage | Usage Notes |
---|---|---|---|
Self-contained | true/false | SelfContained | |
☆ Project path (default) | text | Project | This must be the path to either a project file, solution file, or a directory containing a project or solution file. This argument is required. |
Configuration | text | Configuration | |
Package source | text | PackageSource | If specified, this NuGet package source will be used to restore packages when building. |
Version | text | Version | Value note: "not set". |
Framework | text | Framework | |
Runtime | text | Runtime | |
Output | text | Output | Specifies an output directory for the build. |
VSToolsPath | text | VSToolsPath | Some older .NET applications (especially Framework) may require MSBuild targets included with Visual Studio. Use "embedded" to try resolving these without Visual Studio, "search" to try to find the targets using the Registry, or enter a path like C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VisualStudio\v17.0. Value note: "not set". |
Force dependency resolution | true/false | ForceDependencyResolution | Value note: "false". |
Verbosity | integer | Verbosity | Default value is "Minimal". |
CI build | true/false | ContinuousIntegrationBuild | Sets the ContinuousIntegrationBuild MSBuild flag, which is recommended for all official (non-local) builds. Default value is "True". |
ImageBasedService | text | ImageBasedService | |
Additional arguments | text | AdditionalArguments | |
Ensure dotnet installed | text | EnsureDotNetInstalled | This uses Microsoft's dotnet-install script to ensure that the specified version is installed. Values other than "auto" will be passed to the Channel parameter. The "auto" value will attempt to determine the SDK your project uses and ensure that it is installed. Value note: "not set (do not install)". |
dotnet path | text | DotNetPath | Full path of dotnet.exe (or dotnet on Linux). This is usually C:\Program Files\dotnet\dotnet.exe on Windows. If no value is supplied, the operation will default to %PROGRAMFILES%\dotnet\dotnet.exe for Windows and dotnet (from the path) on Linux. Value note: "default". |
# Publish ~\src\MyProject.csproj with Release configuration for .net core 3.1, restoring NuGet packages from the InternalNuGet source
DotNet::Publish ~\src\MyProject.csproj
(
Configuration: Release,
Framework: netcoreapp3.1,
Runtime: win-x64,
PackageSource: InternalNuGet
);