Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

Download a NuGet package using cmd



  • I followed "https://docs.inedo.com/docs/proget-feeds-nuget" to download the package as follows:

    #https://«proget-server»/«feed-name»/«packageName»/«versionNumber[optional]»
    $headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
    $headers.Add("X-ApiKey", "xyz")

    $response = Invoke-RestMethod 'https://ip:port/feedname/nuget-paclkage-name/version' -Method 'GET' -Headers $headers
    $response | ConvertTo-Json

    I got the error:
    Invoke-RestMethod :
    Not Found

    My question, how can I download a NuGet package as file (e.g., zip)?


  • inedo-engineer

    Hi @hashim-abu-gellban_3562,

    I see a few issues here...

    First, the URL you're using is not correct; the easiest way to to find the url by clicking the "download package link" in the ProGet UI. It will look like this: /nuget/your-feed-name/package/your-package-name/your-version-number

    Second, you're downloading a file - so you want to use a powershell command like this:

    $url = "https://myprogetserver/feeds/mynuggets/package/mypackage/1.0.0"
    $destination = "c:\mypackages\mypackage-1.0.0.zip"
    Invoke-WebRequest -Uri $url -OutFile $destination
    

    Best,
    Steve


Log in to reply
 

Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation