1dotnet publish command(1)          .NET Core         dotnet publish command(1)
2
3
4

dotnet publish

NAME

7       dotnet  publish  -  Packs  the  application and its dependencies into a
8       folder for deployment to a hosting system.
9

SYNOPSIS

11   .NET Core 2.1
12              dotnet publish [<PROJECT>] [-c|--configuration] [-f|--framework] [--force] [--manifest] [--no-build] [--no-dependencies]
13                  [--no-restore] [-o|--output] [-r|--runtime] [--self-contained] [-v|--verbosity] [--version-suffix]
14              dotnet publish [-h|--help]
15
16   .NET Core 2.0
17              dotnet publish [<PROJECT>] [-c|--configuration] [-f|--framework] [--force] [--manifest] [--no-dependencies]
18                  [--no-restore] [-o|--output] [-r|--runtime] [--self-contained] [-v|--verbosity] [--version-suffix]
19              dotnet publish [-h|--help]
20
21   .NET Core 1.x
22              dotnet publish [<PROJECT>] [-c|--configuration] [-f|--framework] [-o|--output] [-r|--runtime] [-v|--verbosity]
23                  [--version-suffix]
24              dotnet publish [-h|--help]
25
26          *   *   *   *   *
27

DESCRIPTION

29       dotnet publish compiles the application, reads through its dependencies
30       specified in the project file, and publishes the resulting set of files
31       to a directory.  The output includes the following assets:
32
33       · Intermediate Language (IL) code in an assembly with a dll extension.
34
35       · .deps.json file that includes all of the dependencies of the project.
36
37       · .runtime.config.json file that specifies the shared runtime that  the
38         application  expects,  as well as other configuration options for the
39         runtime (for example, garbage collection type).
40
41       · The application’s dependencies, which are copied from the NuGet cache
42         into the output folder.
43
44       The  dotnet publish command’s output is ready for deployment to a host‐
45       ing system (for example, a server,  PC,  Mac,  laptop)  for  execution.
46       It’s  the  only officially supported way to prepare the application for
47       deployment.  Depending on the type of deployment that the project spec‐
48       ifies, the hosting system may or may not have the .NET Core shared run‐
49       time installed on it.  For more information, see .NET Core  Application
50       Deployment.   For  the  directory structure of a published application,
51       see Directory structure.
52
53   Arguments
54       PROJECT
55
56       The project to publish.  It’s either the path and filename of a C#, F#,
57       or  Visual Basic project file, or the path to a directory that contains
58       a C#, F#, or Visual Basic project file.  If not specified, it  defaults
59       to the current directory.
60

OPTIONS

62   .NET Core 2.1
63       -c|--configuration {Debug|Release}
64
65       Defines the build configuration.  The default value is Debug.
66
67       -f|--framework <FRAMEWORK>
68
69       Publishes the application for the specified target framework.  You must
70       specify the target framework in the project file.
71
72       --force
73
74       Forces all dependencies to be resolved even if  the  last  restore  was
75       successful.    Specifying  this  flag  is  the  same  as  deleting  the
76       project.assets.json file.
77
78       -h|--help
79
80       Prints out a short help for the command.
81
82       --manifest <PATH_TO_MANIFEST_FILE>
83
84       Specifies one or several target manifests to use to  trim  the  set  of
85       packages published with the app.  The manifest file is part of the out‐
86       put of the dotnet store.  To specify multiple manifests, add a  --mani‐
87       fest  option for each manifest.  This option is available starting with
88       .NET Core 2.0 SDK.
89
90       --no-build
91
92       Doesn’t build the project before publishing.  It also  implicitly  sets
93       the --no-restore flag.
94
95       --no-dependencies
96
97       Ignores  project-to-project  references  and  only  restores  the  root
98       project.
99
100       --no-restore
101
102       Doesn’t execute an implicit restore when running the command.
103
104       -o|--output <OUTPUT_DIRECTORY>
105
106       Specifies the path for the output directory.  If not specified, it  de‐
107       faults  to  ./bin/[configuration]/[framework]/publish/ for a framework-
108       dependent   deployment    or    ./bin/[configuration]/[framework]/[run‐
109       time]/publish/  for  a self-contained deployment.  If the path is rela‐
110       tive, the output directory generated is relative to  the  project  file
111       location, not to the current working directory.
112
113       --self-contained
114
115       Publishes  the  .NET  Core runtime with your application so the runtime
116       doesn’t need to be installed on the target machine.  If a runtime iden‐
117       tifier  is  specified, its default value is true.  For more information
118       about the different deployment types, see .NET Core application deploy‐
119       ment.
120
121       -r|--runtime <RUNTIME_IDENTIFIER>
122
123       Publishes  the application for a given runtime.  This is used when cre‐
124       ating a self-contained deployment (SCD).  For a list of Runtime Identi‐
125       fiers  (RIDs), see the RID catalog.  Default is to publish a framework-
126       dependent deployment (FDD).
127
128       -v|--verbosity <LEVEL>
129
130       Sets the verbosity level of the command.  Allowed values  are  q[uiet],
131       m[inimal], n[ormal], d[etailed], and diag[nostic].
132
133       --version-suffix <VERSION_SUFFIX>
134
135       Defines  the  version suffix to replace the asterisk (*) in the version
136       field of the project file.
137
138   .NET Core 2.0
139       -c|--configuration {Debug|Release}
140
141       Defines the build configuration.  The default value is Debug.
142
143       -f|--framework <FRAMEWORK>
144
145       Publishes the application for the specified target framework.  You must
146       specify the target framework in the project file.
147
148       --force
149
150       Forces  all  dependencies  to  be resolved even if the last restore was
151       successful.   Specifying  this  flag  is  the  same  as  deleting   the
152       project.assets.json file.
153
154       -h|--help
155
156       Prints out a short help for the command.
157
158       --manifest <PATH_TO_MANIFEST_FILE>
159
160       Specifies  one  or  several  target manifests to use to trim the set of
161       packages published with the app.  The manifest file is part of the out‐
162       put  of the dotnet store.  To specify multiple manifests, add a --mani‐
163       fest option for each manifest.  This option is available starting  with
164       .NET Core 2.0 SDK.
165
166       --no-dependencies
167
168       Ignores  project-to-project  references  and  only  restores  the  root
169       project.
170
171       --no-restore
172
173       Doesn’t execute an implicit restore when running the command.
174
175       -o|--output <OUTPUT_DIRECTORY>
176
177       Specifies the path for the output directory.  If not specified, it  de‐
178       faults  to  ./bin/[configuration]/[framework]/publish/ for a framework-
179       dependent   deployment    or    ./bin/[configuration]/[framework]/[run‐
180       time]/publish/  for  a self-contained deployment.  If the path is rela‐
181       tive, the output directory generated is relative to  the  project  file
182       location, not to the current working directory.
183
184       --self-contained
185
186       Publishes  the  .NET  Core runtime with your application so the runtime
187       doesn’t need to be installed on the target machine.  If a runtime iden‐
188       tifier  is  specified, its default value is true.  For more information
189       about the different deployment types, see .NET Core application deploy‐
190       ment.
191
192       -r|--runtime <RUNTIME_IDENTIFIER>
193
194       Publishes  the application for a given runtime.  This is used when cre‐
195       ating a self-contained deployment (SCD).  For a list of Runtime Identi‐
196       fiers  (RIDs), see the RID catalog.  Default is to publish a framework-
197       dependent deployment (FDD).
198
199       -v|--verbosity <LEVEL>
200
201       Sets the verbosity level of the command.  Allowed values  are  q[uiet],
202       m[inimal], n[ormal], d[etailed], and diag[nostic].
203
204       --version-suffix <VERSION_SUFFIX>
205
206       Defines  the  version suffix to replace the asterisk (*) in the version
207       field of the project file.
208
209   .NET Core 1.x
210       -c|--configuration {Debug|Release}
211
212       Defines the build configuration.  The default value is Debug.
213
214       -f|--framework <FRAMEWORK>
215
216       Publishes the application for the specified target framework.  You must
217       specify the target framework in the project file.
218
219       -h|--help
220
221       Prints out a short help for the command.
222
223       --manifest <PATH_TO_MANIFEST_FILE>
224
225       Specifies  one  or  several  target manifests to use to trim the set of
226       packages published with the app.  The manifest file is part of the out‐
227       put  of the dotnet store.  To specify multiple manifests, add a --mani‐
228       fest option for each manifest.  This option is available starting  with
229       .NET Core 2.0 SDK.
230
231       -o|--output <OUTPUT_DIRECTORY>
232
233       Specifies  the path for the output directory.  If not specified, it de‐
234       faults to ./bin/[configuration]/[framework]/publish/ for  a  framework-
235       dependent    deployment    or   ./bin/[configuration]/[framework]/[run‐
236       time]/publish/ for a self-contained deployment.  If the path  is  rela‐
237       tive,  the  output  directory generated is relative to the project file
238       location, not to the current working directory.
239
240       -r|--runtime <RUNTIME_IDENTIFIER>
241
242       Publishes the application for a given runtime.  This is used when  cre‐
243       ating a self-contained deployment (SCD).  For a list of Runtime Identi‐
244       fiers (RIDs), see the RID catalog.  Default is to publish a  framework-
245       dependent deployment (FDD).
246
247       -v|--verbosity <LEVEL>
248
249       Sets  the  verbosity level of the command.  Allowed values are q[uiet],
250       m[inimal], n[ormal], d[etailed], and diag[nostic].
251
252       --version-suffix <VERSION_SUFFIX>
253
254       Defines the version suffix to replace the asterisk (*) in  the  version
255       field of the project file.
256
257          *   *   *   *   *
258

EXAMPLES

260       Publish the project in the current directory:
261
262       dotnet publish
263
264       Publish the application using the specified project file:
265
266       dotnet publish ~/projects/app1/app1.csproj
267
268       Publish  the  project  in the current directory using the netcoreapp1.1
269       framework:
270
271       dotnet publish --framework netcoreapp1.1
272
273       Publish the current application using the netcoreapp1.1  framework  and
274       the  runtime  for  OS  X  10.10  (you must list this RID in the project
275       file).
276
277       dotnet publish --framework netcoreapp1.1 --runtime osx.10.11-x64
278
279       Publish the current application but  don’t  restore  project-to-project
280       (P2P)  references,  just  the root project during the restore operation
281       (.NET Core SDK 2.0 and later versions):
282
283       dotnet publish --no-dependencies
284
285   See also
286       · Target frameworks
287
288       · Runtime IDentifier (RID) catalog
289
290
291
292                                                     dotnet publish command(1)
Impressum