Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Applies to: package publishing • Supported versions: all; 4.1.0+ required for nuget.org
Important
To push packages to nuget.org you must use nuget.exe v4.1.0+, which implements the required NuGet protocols.
Pushes a package to a package source and publishes it.
NuGet's default configuration is obtained by loading %AppData%\NuGet\NuGet.Config (Windows) or ~/.nuget/NuGet/NuGet.Config (Mac/Linux), then loading any Nuget.Config or .nuget\Nuget.Config files starting from root of drive and ending in current directory (see Common NuGet configurations)
Usage
nuget push <packagePath> [options]
where <packagePath> identifies the package to push to the server.
Options
-AllowInsecureConnectionsAllows pushing to HTTP sources (insecure). For more information, refer to https://aka.ms/nuget-https-everywhere.-ApiKeyThe API key for the target repository. If not present, the one specified in the config file is used.
-ConfigFileThe NuGet configuration file to apply. If not specified,
%AppData%\NuGet\NuGet.Config(Windows), or~/.nuget/NuGet/NuGet.Configor~/.config/NuGet/NuGet.Config(Mac/Linux) is used.-DisableBufferingDisables buffering when pushing to an HTTP(s) server to decrease memory usages. Caution: when this option is used, integrated Windows authentication might not work.
-ForceEnglishOutput(3.5+) Forces nuget.exe to run using an invariant, English-based culture.
-?|-helpDisplays help information for the command.
-NonInteractiveSuppresses prompts for user input or confirmations.
-NoServiceEndpointDoes not append
api/v2/packagesto the source URL.-NoSymbols(3.5+) If a symbols package exists, it will not be pushed to a symbol server.
-src|-SourceSpecifies the server URL. NuGet identifies a UNC or local folder source and simply copies the file there instead of pushing it using HTTP. Also, starting with NuGet 3.4.2, this is a mandatory parameter unless the
NuGet.Configfile specifies a DefaultPushSource value (see Configuring NuGet behavior).-SkipDuplicate(5.1+) If a package and version already exists, skip it and continue with the next package in the push, if any. This option is ignored if the package is being pushed to a UNC or local folder source.
-SymbolSourceSpecifies the symbol server URL.
-SymbolApiKey(3.5+) Specifies the API key for the URL specified in
-SymbolSource.-TimeoutSpecifies the timeout, in seconds, for pushing to a server. The default is 300 seconds (5 minutes).
-Verbosity [normal|quiet|detailed]Specifies the amount of detail displayed in the output:
normal(the default),quiet, ordetailed.
Also see Environment variables
Examples
nuget push foo.nupkg
nuget push foo.symbols.nupkg
nuget push foo.nupkg -Timeout 360
nuget push *.nupkg
nuget.exe push -source \\mycompany\repo\ mypackage.1.0.0.nupkg
nuget push foo.nupkg 4003d786-cc37-4004-bfdf-c4f3e8ef9b3a -Source https://api.nuget.org/v3/index.json
nuget push foo.nupkg 4003d786-cc37-4004-bfdf-c4f3e8ef9b3a
nuget push foo.nupkg 4003d786-cc37-4004-bfdf-c4f3e8ef9b3a -src https://customsource/
:: In the example below -SkipDuplicate will skip pushing the package if package "Foo" version "5.0.2" already exists on NuGet.org
nuget push Foo.5.0.2.nupkg 4003d786-cc37-4004-bfdf-c4f3e8ef9b3a -src https://api.nuget.org/v3/index.json -SkipDuplicate
- For pushing to Azure Artifacts, see Azure Artifacts' push documentation.