Push multiple packages to private nuget (VSTS) with one command

一曲冷凌霜 提交于 2019-12-01 05:29:20

问题


I'm trying to push multiple nuget packages at ONCE to private VSTS nuget server.

I searched doco but could not find a batch Push command. I'm using the command below which seems to overwrite already existing nuget packages on VSTS.

nuget push mynuget.nupkg -Source https://myvsts.pkgs.visualstudio.com/DefaultCollection/_packaging/SitecorePackages/nuget/v3/index.json -ApiKey VSTS

UPDATE:

I used the push *.nupkg however, I can see only the 8.1.x version pushed.

Thanks.


回答1:


It's not possible to overwrite existing packages on VSTS. nuget.exe allows wildcards for push, so you could say nuget push *.nupkg -Source https://myvsts.pkgs.visualstudio.com/DefaultCollection/_packaging/SitecorePackages/nuget/v3/index.json -ApiKey VSTS.




回答2:


First, I exclude previously uploaded packages from the "packages" folder and it contains only packages that not exists in local server. After that I use below command and it works fine.

nuget.exe push -Source "MyFeedName" -ApiKey VSTS packages\**\*.nupkg



回答3:


Here is a powershell script you can use to bulk push NuGet packages to a VSTS feed. It will ignore any of the .symbols.nuget files:

set-location \\path\to\nugetpackages

$files=get-childitem | where {$_.Name -like "*.nupkg" -and $_.Name -notlike "*symbols*"}

foreach($file in $files) {
  .\NuGet.exe push -Source "MySource" -ApiKey key $file.name
}


来源:https://stackoverflow.com/questions/37185121/push-multiple-packages-to-private-nuget-vsts-with-one-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!