Home >Backend Development >C#.Net Tutorial >.NET Core CLI tool documentation dotnet-build
Name
dotnet-build -- Build the project and all dependencies
Summary
`dotnet build [--output]
[--build-base-path] [--framework] [--configuration] [--runtime] [--version-suffix] [--build-profile] [--no-incremental] [--no-dependencies] [<project>]`
Description
The dotnet build command builds a project from multiple source files and their dependencies Generate a binary file. By default, the binary will be in Intermediate Language (IL) and will have a DLL extension. dotnet build will also generate a *.deps outline file that the host application needs to run.
Building requires the existence of a lock file, which means you must first run dotnet restore when generating your code.
Before any compilation begins, generate verbs to analyze the project and its dependencies for incremental security checks. If all checks pass, then it continues building incremental compilation with the project and its dependencies; otherwise, it falls back to non-incremental compilation. Via a flag on the side, users can choose to receive additional information on how they can improve their build times.
All projects in the dependency graph that need to be compiled must pass the following security checks so that the compilation process is incremental:
Do not use pre/post compilation scripts
No compilation tools (eg: resgen, compiler) are loaded from PATH
Use only known compilers (CSC, VBC, FSC)
In order to generate an executable application you need a special configuration section in your project.json file:
{ "compilerOptions": { "emitEntryPoint": true } }
option
-o, --output [DIR]
Directory to place generated binaries.
-b, --build-base-path [DIR]
Directory to place temporary output.
-f, --framework [FRAMEWORK]
Compile a specified framework. The framework needs to be defined in the project.json file.
-c, --configuration [Debug|Release]
Define a configuration under generation. If omitted, defaults to debugging.
-r, --runtime [RUNTIME_IDENTIFIER]
The generated target runtime.
--version-suffix [VERSION_SUFFIX]
defines * the version field that should be replaced in the project.json file. The format follows NuGet's version style.
--build-profile
Print out the security checks the user needs to automatically turn on in order for incremental compilation to resolve incremental builds.
--no-incremental
marks the build as an unsafe incremental build. This turns off incremental compilation, forcing a clean rebuild of the project's dependency graph.
--no-dependencies
Ignore project-to-project references and only build the root project for the specified build.