Internet Explorer is no longer supported. Many things will still work, but your experience will be degraded and some things won't function. Please use a modern browser such as Edge, Chrome, or Firefox.

Download Virtual Package

view on GitHub

Download Virtual Package is available as both a pgutil command and an HTTP Request, and will download the package.version.vpack file for a virtual package, or throw error if not a virtual package.

Parameter Description

Parameter Details
group-name Optional. If not specified, the empty group will be searched.
package-name Required.
package-version Optional.

HTTP Request Specification

To download a specific virtual package version, simply GET to the URL with a feed name, group name, package name and package version:

GET /upack/«feed-name»/download-vpack/«group-name»/«package-name»/«package-version»

To download the latest version of a virtual package, simply GET to the URL with a feed name, group name and package name:

GET /upack/«feed-name»/download-vpack/«group-name»/«package-name»?latest

Downloading a specific version of a virtual package requires the feed (e.g. myUniversalFeed), group name (e.g. myGroup), package name (e.g. myVirtualPackage) and version (e.g. 1.2.3):

GET /upack/myUniversalFeed/download-vpack/myGroup/myVirtualPackage/1.2.3

Downloading the latest version of a virtual package requires the feed (e.g. myUniversalFeed), group name (e.g. myGroup), and package name (e.g. myVirtualPackage):

GET /upack/myUniversalFeed/download-vpack/myGroup/myVirtualPackage?latest

Command Specification (CLI)

HTTP Response Specification

Response Details
200 (Success) will successfully download the virtual package
400 (Virtual Package Version not Found) returned if package-version is not specified, and latest is not specified in the URL
403 (Unauthorized API Key) indicates a missing, unknown, or unauthorized API Key
404 (Virtual Package Not Found) indicates the specified virtual package does not exist

Sample Usage Scripts

Download all versions of a virtual package (Powershell)

This script will download all versions of the virtual package BaseModules.Combined from the universal feed universal-feed to the local folder C:\ProGet\BaseModule Packages

$baseUrl = "https://proget.corp.local"
$apiKey = "a1b2c3d4e5"
$feedName = "universal-feed"
$packageName = "BaseModules.Combined"
$outputFolder = "C:\ProGet\BaseModule Packages"

$listPackagesEndpoint = "$baseUrl/upack/$feedName/versions" + "?name=$packageName"
$downloadPackagesEndpoint = "$baseUrl/upack/$feedName/download-vpack"

$headers = @{"X-ApiKey" = $apiKey}
$listResponse = Invoke-RestMethod -Uri $listPackagesEndpoint -Headers $headers -Method Get

foreach ($package in $listResponse) {
    if ($package.isVirtual -eq $true) {
        $packageVersion = $package.version
        $packageGroup = $package.group

        $downloadUrl = "$downloadPackagesEndpoint/$packageGroup/$packageName/$packageVersion" + "?contentOnly=zip"
        $outputFilePath = Join-Path $outputFolder "$packageName-$packageVersion.vpack"

        Invoke-WebRequest -Uri $downloadUrl -Headers $headers -OutFile $outputFilePath
        Write-Host "Downloaded: $outputFilePath"
    }
}

Download all virtual package (Powershell)

This script will download all virtual packages from the universal feed universal-feed to the local folder C:\ProGet\Virtual Packages

$baseUrl = "https://proget.corp.local"
$apiKey = "a1b2c3d4e5"
$feedName = "universal-feed"
$outputFolder = "C:\ProGet\Virtual Packages"

$listPackagesEndpoint = "$baseUrl/upack/$feedName/versions"
$downloadPackagesEndpoint = "$baseUrl/upack/$feedName/download-vpack"

$headers = @{"X-ApiKey" = $apiKey}
$listResponse = Invoke-RestMethod -Uri $listPackagesEndpoint -Headers $headers -Method Get

foreach ($package in $listResponse) {
    if ($package.isVirtual -eq $true) {
        $packageName = $package.name
        $packageVersion = $package.version
        $packageGroup = $package.group

        $downloadUrl = "$downloadPackagesEndpoint/$packageGroup/$packageName/$packageVersion" + "?contentOnly=zip"
        $outputFilePath = Join-Path $outputFolder "$packageName-$packageVersion.vpack"

        Invoke-WebRequest -Uri $downloadUrl -Headers $headers -OutFile $outputFilePath
        Write-Host "Downloaded: $outputFilePath"
    }
}