1dotnet build command - .NET Core CLI.(N1E)TdCootrneet build command - .NET Core CLI(1)
2
3
4

dotnet-build

NAME

7       dotnet build - Builds a project and all of its dependencies.
8

SYNOPSIS

10   .NET Core 2.x
11              dotnet build [<PROJECT>] [-c|--configuration] [-f|--framework] [--force] [--no-dependencies] [--no-incremental]
12                  [--no-restore] [-o|--output] [-r|--runtime] [-v|--verbosity] [--version-suffix]
13              dotnet build [-h|--help]
14
15   .NET Core 1.x
16              dotnet build [<PROJECT>] [-c|--configuration] [-f|--framework] [--no-dependencies] [--no-incremental] [-o|--output]
17                  [-r|--runtime] [-v|--verbosity] [--version-suffix]
18              dotnet build [-h|--help]
19
20          *   *   *   *   *
21

DESCRIPTION

23       The dotnet build command builds the project and its dependencies into a
24       set of binaries.  The binaries include the project's code in Intermedi‐
25       ate Language (IL) files with a .dll extension and symbol files used for
26       debugging  with  a  .pdb   extension.    A   dependencies   JSON   file
27       (*.deps.json)  is  produced that lists the dependencies of the applica‐
28       tion.  A *.runtimeconfig.json file is  produced,  which  specifies  the
29       shared runtime and its version for the application.
30
31       If  the  project  has  third-party dependencies, such as libraries from
32       NuGet, they're resolved from the NuGet cache and aren't available  with
33       the  project's  built  output.   With that in mind, the product of dot‐
34       net build isn't ready to be transferred  to  another  machine  to  run.
35       This  is  in  contrast  to  the behavior of the .NET Framework in which
36       building an executable project (an application) produces output  that's
37       runnable on any machine where the .NET Framework is installed.  To have
38       a similar experience with .NET Core, you need to use the dotnet publish
39       command.  For more information, see .NET Core Application Deployment.
40
41       Building  requires the project.assets.json file, which lists the depen‐
42       dencies of your application.  The file is created  when  dotnet restore
43       is  executed.  Without the assets file in place, the tooling cannot re‐
44       solve reference assemblies, which results in errors.   With  .NET  Core
45       1.x SDK, you needed to explicitly run the dotnet restore before running
46       dotnet build.  Starting with .NET Core 2.0 SDK, dotnet restore runs im‐
47       plicitly  when  you  run dotnet build.  If you want to disable implicit
48       restore when running the build command, you can pass  the  --no-restore
49       option.
50
51       dotnet build  uses  MSBuild  to  build the project, so it supports both
52       parallel and incremental builds.  For more information, see Incremental
53       Builds.
54
55       In  addition  to  its options, the dotnet build command accepts MSBuild
56       options, such as /p for setting properties or /l to  define  a  logger.
57       For  more information about these options, see the MSBuild Command-Line
58       Reference.
59
60       Whether the project is executable or not is determined by the  <Output‐
61       Type>  property  in  the  project  file.  The following example shows a
62       project that produces executable code:
63
64              <PropertyGroup>
65                <OutputType>Exe</OutputType>
66              </PropertyGroup>
67
68       In order to produce a library, omit  the  <OutputType>  property.   The
69       main  difference  in  built  output  is  that  the IL DLL for a library
70       doesn't contain entry points and can't be executed.
71
72   Arguments
73       PROJECT
74
75       The project file to build.  If a project file is not specified, MSBuild
76       searches  the  current working directory for a file that has a file ex‐
77       tension that ends in proj and uses that file.
78

OPTIONS

80   .NET Core 2.x
81       -c|--configuration {Debug|Release}
82
83       Defines the build configuration.  The default value is Debug.
84
85       -f|--framework <FRAMEWORK>
86
87       Compiles for a specific framework.  The framework must  be  defined  in
88       the project file.
89
90       --force
91
92       Forces  all  dependencies  to  be resolved even if the last restore was
93       successful.   Specifying  this  flag  is  the  same  as  deleting   the
94       project.assets.json file.
95
96       -h|--help
97
98       Prints out a short help for the command.
99
100       --no-dependencies
101
102       Ignores  project-to-project (P2P) references and only builds the speci‐
103       fied root project.
104
105       --no-incremental
106
107       Marks the build as unsafe for incremental build.  This flag  turns  off
108       incremental compilation and forces a clean rebuild of the project's de‐
109       pendency graph.
110
111       --no-restore
112
113       Doesn't execute an implicit restore during build.
114
115       -o|--output <OUTPUT_DIRECTORY>
116
117       Directory in which to place the built binaries.  You also need  to  de‐
118       fine --framework when you specify this option.
119
120       -r|--runtime <RUNTIME_IDENTIFIER>
121
122       Specifies  the  target  runtime.   For  a  list  of Runtime Identifiers
123       (RIDs), see the RID catalog.
124
125       -v|--verbosity <LEVEL>
126
127       Sets the verbosity level of the command.  Allowed values  are  q[uiet],
128       m[inimal], n[ormal], d[etailed], and diag[nostic].
129
130       --version-suffix <VERSION_SUFFIX>
131
132       Defines  the version suffix for an asterisk (*) in the version field of
133       the project file.  The format follows NuGet's version guidelines.
134
135   .NET Core 1.x
136       -c|--configuration {Debug|Release}
137
138       Defines the build configuration.  The default value is Debug.
139
140       -f|--framework <FRAMEWORK>
141
142       Compiles for a specific framework.  The framework must  be  defined  in
143       the project file.
144
145       -h|--help
146
147       Prints out a short help for the command.
148
149       --no-dependencies
150
151       Ignores  project-to-project (P2P) references and only builds the speci‐
152       fied root project.
153
154       --no-incremental
155
156       Marks the build as unsafe for incremental build.  This flag  turns  off
157       incremental compilation and forces a clean rebuild of the project's de‐
158       pendency graph.
159
160       -o|--output <OUTPUT_DIRECTORY>
161
162       Directory in which to place the built binaries.  You also need  to  de‐
163       fine --framework when you specify this option.
164
165       -r|--runtime <RUNTIME_IDENTIFIER>
166
167       Specifies  the  target  runtime.   For  a  list  of Runtime Identifiers
168       (RIDs), see the RID catalog.
169
170       -v|--verbosity <LEVEL>
171
172       Sets the verbosity level of the command.  Allowed values  are  q[uiet],
173       m[inimal], n[ormal], d[etailed], and diag[nostic].
174
175       --version-suffix <VERSION_SUFFIX>
176
177       Defines  the version suffix for an asterisk (*) in the version field of
178       the project file.  The format follows NuGet's version guidelines.
179
180          *   *   *   *   *
181

EXAMPLES

183       Build a project and its dependencies:
184
185       dotnet build
186
187       Build a project and its dependencies using Release configuration:
188
189       dotnet build --configuration Release
190
191       Build a project and its dependencies for a specific  runtime  (in  this
192       example, Ubuntu 16.04):
193
194       dotnet build --runtime ubuntu.16.04-x64
195
196       Build the project and use the specified NuGet package source during the
197       restore operation (.NET Core SDK 2.0 and later versions):
198
199       dotnet build --source c:\packages\mypackages
200

AUTHORS

202       mairaw.
203
204
205
206                                       dotnet build command - .NET Core CLI(1)
Impressum