1dotnet pack command - .NET Core CLI(.1N)ET Cdoortenet pack command - .NET Core CLI(1)
2
3
4

dotnet pack

NAME

7       dotnet pack - Packs the code into a NuGet package.
8

SYNOPSIS

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

DESCRIPTION

23       The  dotnet pack command builds the project and creates NuGet packages.
24       The result of this command is a NuGet package.  If  the  --include-sym‐
25       bols option is present, another package containing the debug symbols is
26       created.
27
28       NuGet dependencies of the packed project are added to the .nuspec file,
29       so   they're   properly   resolved   when  the  package  is  installed.
30       Project-to-project references aren't packaged inside the project.  Cur‐
31       rently,   you   must   have   a   package   per  project  if  you  have
32       project-to-project dependencies.
33
34       By default, dotnet pack builds the project first.  If you wish to avoid
35       this behavior, pass the --no-build option.  This option is often useful
36       in Continuous Integration (CI) build scenarios where you know the  code
37       was previously built.
38
39       You  can  provide MSBuild properties to the dotnet pack command for the
40       packing process.  For more information, see NuGet  metadata  properties
41       and the MSBuild Command-Line Reference.  The Examples section shows how
42       to use the MSBuild /p switch for a couple of different scenarios.
43
44   Arguments
45       PROJECT
46
47       The project to pack.  It's either a path to a csproj file or to  a  di‐
48       rectory.  If not specified, it defaults to the current directory.
49

OPTIONS

51   .NET Core 2.x
52       -c|--configuration {Debug|Release}
53
54       Defines the build configuration.  The default value is Debug.
55
56       --force
57
58       Forces  all  dependencies  to  be resolved even if the last restore was
59       successful.   Specifying  this  flag  is  the  same  as  deleting   the
60       project.assets.json file.
61
62       -h|--help
63
64       Prints out a short help for the command.
65
66       --include-source
67
68       Includes  the source files in the NuGet package.  The sources files are
69       included in the src folder within the nupkg.
70
71       --include-symbols
72
73       Generates the symbols nupkg.
74
75       --no-build
76
77       Doesn't build the project before packing.  It also  implicit  sets  the
78       --no-restore flag.
79
80       --no-dependencies
81
82       Ignores  project-to-project  references  and  only  restores  the  root
83       project.
84
85       --no-restore
86
87       Doesn't execute an implicit restore when running the command.
88
89       -o|--output <OUTPUT_DIRECTORY>
90
91       Places the built packages in the directory specified.
92
93       --runtime <RUNTIME_IDENTIFIER>
94
95       Specifies the target runtime to restore packages for.  For  a  list  of
96       Runtime Identifiers (RIDs), see the RID catalog.
97
98       -s|--serviceable
99
100       Sets  the  serviceable  flag in the package.  For more information, see
101       .NET Blog: .NET 4.5.1 Supports  Microsoft  Security  Updates  for  .NET
102       NuGet Libraries.
103
104       --version-suffix <VERSION_SUFFIX>
105
106       Defines  the  value  for  the  $(VersionSuffix) MSBuild property in the
107       project.
108
109       -v|--verbosity <LEVEL>
110
111       Sets the verbosity level of the command.  Allowed values  are  q[uiet],
112       m[inimal], n[ormal], d[etailed], and diag[nostic].
113
114   .NET Core 1.x
115       -c|--configuration {Debug|Release}
116
117       Defines the build configuration.  The default value is Debug.
118
119       -h|--help
120
121       Prints out a short help for the command.
122
123       --include-source
124
125       Includes  the source files in the NuGet package.  The sources files are
126       included in the src folder within the nupkg.
127
128       --include-symbols
129
130       Generates the symbols nupkg.
131
132       --no-build
133
134       Doesn't build the project before packing.
135
136       -o|--output <OUTPUT_DIRECTORY>
137
138       Places the built packages in the directory specified.
139
140       -s|--serviceable
141
142       Sets the serviceable flag in the package.  For  more  information,  see
143       .NET  Blog:  .NET  4.5.1  Supports  Microsoft Security Updates for .NET
144       NuGet Libraries.
145
146       --version-suffix <VERSION_SUFFIX>
147
148       Defines the value for the  $(VersionSuffix)  MSBuild  property  in  the
149       project.
150
151       -v|--verbosity <LEVEL>
152
153       Sets  the  verbosity level of the command.  Allowed values are q[uiet],
154       m[inimal], n[ormal], d[etailed], and diag[nostic].
155
156          *   *   *   *   *
157

EXAMPLES

159       Pack the project in the current directory:
160
161       dotnet pack
162
163       Pack the app1 project:
164
165       dotnet pack ~/projects/app1/project.csproj
166
167       Pack the project in the current directory and place the resulting pack‐
168       ages into the nupkgs folder:
169
170       dotnet pack --output nupkgs
171
172       Pack  the  project  in the current directory into the nupkgs folder and
173       skip the build step:
174
175       dotnet pack --no-build --output nupkgs
176
177       With the project's version suffix configured  as  <VersionSuffix>$(Ver‐
178       sionSuffix)</VersionSuffix>  in  the  .csproj  file,  pack  the current
179       project and update the resulting package version with the given suffix:
180
181       dotnet pack --version-suffix "ci-1234"
182
183       Set the package version to 2.1.0 with the PackageVersion MSBuild  prop‐
184       erty:
185
186       dotnet pack /p:PackageVersion=2.1.0
187
188       Pack the project for a specific target framework:
189
190       dotnet pack /p:TargetFrameworks=net45
191
192       Pack  the  project  and use a specific runtime (Windows 10) for the re‐
193       store operation (.NET Core SDK 2.0 and later versions):
194
195       dotnet pack --runtime win10-x64
196

AUTHORS

198       mairaw.
199
200
201
202                                        dotnet pack command - .NET Core CLI(1)
Impressum