← 返回命令列表

Linux command

dotnet-build 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Build current project

dotnet build

Build in Release

dotnet build -c Release

Build specific project

dotnet build [path/to/project.csproj]

Build without restoring

dotnet build --no-restore

Build for specific

dotnet build -f [net8.0]

Build with specific

dotnet build -o [./output]

说明

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.

参数

-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.

FAQ

What is the dotnet-build command used for?

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.

How do I run a basic dotnet-build example?

Run `dotnet build` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -c, --configuration _CONFIG_ do in dotnet-build?

Build configuration (Debug, Release).