1(1) .NET (1)
2
3
4
6 This article applies to: ✔️ .NET Core 2.x SDK and later versions
7
9 dotnet nuget push - Pushes a package to the server and publishes it.
10
12 dotnet nuget push [<ROOT>] [-d|--disable-buffering] [--force-english-output]
13 [--interactive] [-k|--api-key <API_KEY>] [-n|--no-symbols]
14 [--no-service-endpoint] [-s|--source <SOURCE>] [--skip-duplicate]
15 [-sk|--symbol-api-key <API_KEY>] [-ss|--symbol-source <SOURCE>]
16 [-t|--timeout <TIMEOUT>]
17
18 dotnet nuget push -h|--help
19
21 The dotnet nuget push command pushes a package to the server and pub‐
22 lishes it. The push command uses server and credential details found
23 in the system’s NuGet config file or chain of config files. For more
24 information on config files, see Configuring NuGet Behavior. NuGet’s
25 default configuration is obtained by loading %AppData%.config (Windows)
26 or $HOME/.local/share (Linux/macOS), then loading any nuget.config or
27 .nuget.config starting from the root of drive and ending in the current
28 directory.
29
30 The command pushes an existing package. It doesn’t create a package.
31 To create a package, use dotnet pack.
32
33 Arguments
34 • ROOT
35
36 Specifies the file path to the package to be pushed.
37
39 • -d|--disable-buffering
40
41 Disables buffering when pushing to an HTTP(S) server to reduce memory
42 usage.
43
44 • --force-english-output
45
46 Forces the application to run using an invariant, English-based cul‐
47 ture.
48
49 • -?|-h|--help
50
51 Prints out a description of how to use the command.
52
53 • --interactive
54
55 Allows the command to stop and wait for user input or action. For
56 example, to complete authentication. Available since .NET Core 3.0
57 SDK.
58
59 • -k|--api-key <API_KEY>
60
61 The API key for the server.
62
63 • -n|--no-symbols
64
65 Doesn’t push symbols (even if present).
66
67 • --no-service-endpoint
68
69 Doesn’t append “api/v2/package” to the source URL. Option available
70 since .NET Core 2.1 SDK.
71
72 • -s|--source <SOURCE>
73
74 Specifies the server URL. NuGet identifies a UNC or local folder
75 source and simply copies the file there instead of pushing it using
76 HTTP. > [!IMPORTANT] > Starting with NuGet 3.4.2, this is a mandato‐
77 ry parameter unless the NuGet config file specifies a DefaultPush‐
78 Source value. For more information, see Configuring NuGet behavior.
79
80 • --skip-duplicate
81
82 When pushing multiple packages to an HTTP(S) server, treats any 409
83 Conflict response as a warning so that the push can continue. Avail‐
84 able since .NET Core 3.1 SDK.
85
86 • -sk|--symbol-api-key <API_KEY>
87
88 The API key for the symbol server.
89
90 • -ss|--symbol-source <SOURCE>
91
92 Specifies the symbol server URL.
93
94 • -t|--timeout <TIMEOUT>
95
96 Specifies the timeout for pushing to a server in seconds. Defaults
97 to 300 seconds (5 minutes). Specifying 0 applies the default value.
98
100 • Push foo.nupkg to the default push source specified in the NuGet con‐
101 fig file, using an API key:
102
103 dotnet nuget push foo.nupkg -k 4003d786-cc37-4004-bfdf-c4f3e8ef9b3a
104
105 • Push foo.nupkg to the official NuGet server, specifying an API key:
106
107 dotnet nuget push foo.nupkg -k 4003d786-cc37-4004-bfdf-c4f3e8ef9b3a -s https://api.nuget.org/v3/index.json
108
109 • Push foo.nupkg to the custom push source https://customsource,
110 specifying an API key:
111
112 dotnet nuget push foo.nupkg -k 4003d786-cc37-4004-bfdf-c4f3e8ef9b3a -s https://customsource/
113
114 • Push foo.nupkg to the default push source specified in the NuGet con‐
115 fig file:
116
117 dotnet nuget push foo.nupkg
118
119 • Push foo.symbols.nupkg to the default symbols source:
120
121 dotnet nuget push foo.symbols.nupkg
122
123 • Push foo.nupkg to the default push source specified in the NuGet con‐
124 fig file, with a 360-second timeout:
125
126 dotnet nuget push foo.nupkg --timeout 360
127
128 • Push all .nupkg files in the current directory to the default push
129 source specified in the NuGet config file:
130
131 dotnet nuget push "*.nupkg"
132
133 [!NOTE] If this command doesn’t work, it might be due to a bug
134 that existed in older versions of the SDK (.NET Core 2.1 SDK
135 and earlier versions). To fix this, upgrade your SDK version
136 or run the following command instead: dotnet nuget push
137 "**/*.nupkg"
138
139 [!NOTE] The enclosing quotes are required for shells such as
140 bash that perform file globbing. For more information, see
141 NuGet/Home#4393 (https://github.com/NuGet/Home/issues/4393#is‐
142 suecomment-667618120).
143
144 • Push all .nupkg files to the default push source specified in the
145 NuGet config file, even if a 409 Conflict response is returned by an
146 HTTP(S) server:
147
148 dotnet nuget push "*.nupkg" --skip-duplicate
149
150 • Push all .nupkg files in the current directory to a local feed direc‐
151 tory:
152
153 dotnet nuget push "*.nupkg" -s c:\mydir
154
155 This command doesn’t store packages in a hierarchical folder struc‐
156 ture, which is recommended to optimize performance. For more infor‐
157 mation, see Local feeds.
158
159
160
161 (1)