LinuxCommandLibrary

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. Clean builds with dotnet clean if needed. Framework targeting requires compatible SDK. Build errors stop the process.

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

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community