适用于: 包发布 • 支持的版本: 全部;nuget.org 所需的 4.1.0+
重要
若要将包推送到 nuget.org 必须使用 v4.1.0+ nuget.exe,该 v4.1.0+ 可实现所需的 NuGet 协议。
将包推送到包源并发布它。
NuGet 的默认配置是通过加载 %AppData%\NuGet\NuGet.Config (Windows) 或 ~/.nuget/NuGet/NuGet.Config (Mac/Linux) 获取的,然后从驱动器根开始加载任何 Nuget.Config 文件或 .nuget\Nuget.Config 以当前目录结束的文件(请参阅 通用 NuGet 配置)
Usage
nuget push <packagePath> [options]
其中 <packagePath> 标识要推送到服务器的包。
选项
-AllowInsecureConnections允许推送到 HTTP 源(不安全)。 有关详细信息,请参阅 https://aka.ms/nuget-https-everywhere。-ApiKey目标存储库的 API 密钥。 如果不存在,则使用配置文件中指定的配置文件。
-ConfigFile要应用的 NuGet 配置文件。 如果未指定,
%AppData%\NuGet\NuGet.Config则使用 (Windows)或~/.config/NuGet/NuGet.Config~/.nuget/NuGet/NuGet.Config(Mac/Linux)。-DisableBuffering在推送到 HTTP(s) 服务器以减少内存使用量时禁用缓冲。 警告:使用此选项时,集成 Windows 身份验证可能无法正常工作。
-ForceEnglishOutput(3.5+) 强制 nuget.exe 使用基于英语的固定区域性运行。
-?|-help显示命令的帮助信息。
-NonInteractive禁止提示用户输入或确认。
-NoServiceEndpoint不追加
api/v2/packages到源 URL。-NoSymbols(3.5+) 如果符号包存在,则不会将其推送到符号服务器。
-src|-Source指定服务器 URL。 NuGet 标识 UNC 或本地文件夹源,只需将文件复制到那里,而不是使用 HTTP 进行推送。 此外,从 NuGet 3.4.2 开始,这是一个必需参数,除非
NuGet.Config文件指定 DefaultPushSource 值(请参阅 配置 NuGet 行为)。-SkipDuplicate(5.1+) 如果包和版本已存在,请跳过它并继续推送中的下一个包(如果有)。 如果将包推送到 UNC 或本地文件夹源,则忽略此选项。
-SymbolSource指定符号服务器 URL。
-SymbolApiKey(3.5+) 指定在 . 中指定的
-SymbolSourceURL 的 API 密钥。-Timeout指定推送到服务器的超时(以秒为单位)。 默认值为 300 秒(5 分钟)。
-Verbosity [normal|quiet|detailed]指定输出中显示的详细信息量:
normal(默认值),quiet或detailed。
另请参阅 环境变量
例子
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
- 有关推送到 Azure Artifacts 的信息, 请参阅 Azure Artifacts 的推送文档。