如何从命令行发布到私有 nuget 存储库?

How do I publish to a private nuget repository from the command line?

我发现 several helpful documents 关于这个主题,但我似乎无法弄清它们的主要内容。有人可以像我五岁那样向我解释如何从命令行发布到私有 nuget 存储库吗?具体来说,我如何对我的人工 nuget 存储库进行身份验证?我使用的命令是

nuget push Mypkg1.0.0.nupkg -Source http://artifactory/artifactory/api/nuget/MypgkRepo

我对 nuget 的经验为零,但正在努力使其成为我们构建过程的一部分,以便仅构建更改的内容并从 repo 中获取其余部分。谢谢!

我想诀窍是您必须在尝试推送之前添加经过身份验证的源。例如,

nuget sources add -Name A -Source http://af/artifactory/api/nuget/MyPkgRepo -User user -pass pass

(from here)

然后这样调用setapikey

nuget setapikey user:pass -Source A

Source

做完之后,我可以说

nuget push Mypkg1.0.0.nupkg -Source A

它说 "Using credentials from config" 而不是问我要我的。