LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

dotnet-build

.NET project compiler and builder

TLDR

Build current project
$ dotnet build
copy
Build in Release configuration
$ dotnet build -c Release
copy
Build specific project
$ dotnet build [path/to/project.csproj]
copy
Build without restoring
$ dotnet build --no-restore
copy
Build for specific framework
$ dotnet build -f [net8.0]
copy
Build with specific output directory
$ dotnet build -o [./output]
copy

SYNOPSIS

dotnet build [project] [options]

DESCRIPTION

dotnet build compiles .NET projects and their dependencies, producing assemblies and other output files. It invokes MSBuild under the hood with .NET-specific configurations.The command automatically restores NuGet packages before building unless --no-restore is specified. It supports building multiple projects in a solution file and handles project references.Output includes compiled assemblies (.dll), debug symbols, and any content files configured in the project.

PARAMETERS

PROJECT

Project or solution file to build.
-c, --configuration CONFIG
Build configuration (Debug, Release).
-f, --framework FRAMEWORK
Target framework.
-o, --output DIR
Output directory.
--no-restore
Build without restoring dependencies.
--no-dependencies
Ignore project-to-project references.
-v, --verbosity LEVEL
Verbosity: quiet, minimal, normal, detailed.
--help
Display help information.

CAVEATS

Incremental builds may miss some changes; use dotnet clean before rebuilding if needed. Multi-targeting requires listing frameworks in the project file. The default configuration is Debug unless -c Release is specified.

HISTORY

dotnet build is part of the .NET CLI introduced with .NET Core. It provides a cross-platform build experience replacing platform-specific build tools.

SEE ALSO

Copied to clipboard
Kai