无法在VSTS上覆盖现有软件包。nuget.exe允许使用通配符进行推送,因此您可以使用nuget push *.nupkg -Source https://myvsts.pkgs.visualstudio.com/DefaultCollection/_packaging/SitecorePackages/nuget/v3/index.json -ApiKey VSTS
。
这里是一个PowerShell脚本,可以用来批量推送NuGet包到VSTS feed。它会忽略任何以.symbols.nuget结尾的文件:
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
}
首先,我从“packages”文件夹中排除以前上传的软件包,它只包含本地服务器上不存在的软件包。之后,我使用下面的命令,它能够正常工作。
nuget.exe push -Source "MyFeedName" -ApiKey VSTS packages\**\*.nupkg
**
通配符执行递归文件夹搜索,对此非常简单和有用。 - Andy Hames