Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

enter image description here

Thanks.

like image 415
Nil Pun Avatar asked May 12 '16 11:05

Nil Pun


People also ask

How do I add a NuGet package to private?

To add the private NuGet feed link using Visual Studio. Launch Visual Studio, right-click the project, and choose Manage NuGet Packages. Click the + button after selecting the Package Manager setting. Select Okay after providing the Name and Source (URL) of your NuGet Feed.

How use NuGet command line?

To use any command, open a command window or bash shell, then run nuget followed by the command and appropriate options, such as nuget help pack (to view help on the pack command). This documentation reflects the latest version of the NuGet CLI.

What is Nuspec file?

nuspec file is an XML manifest that contains package metadata. This manifest is used both to build the package and to provide information to consumers. The manifest is always included in a package. In this topic: General form and schema.


2 Answers

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.

like image 195
Matt Cooper Avatar answered Oct 04 '22 23:10

Matt Cooper


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
}
like image 23
TetraDev Avatar answered Oct 04 '22 23:10

TetraDev