Skip to content

Import packages from a local feed

Local feeds let you use a folder as a NuGet package source.

Info

Please refer to the BaGet vs local feeds page for reasons to upgrade to BaGet.

Steps

Make sure that you've installed nuget.exe. In PowerShell, run:

$source = "C:\path\to\local\feed"
$destination = "http://localhost:5000/v3/index.json"

If you've configured BaGet to require an API Key, set it using the setapikey command:

& nuget.exe setapikey "MY-API-KEY" -Source $destination

Now run the following PowerShell script:

$packages = nuget list -AllVersions -Source $source

$packages | % {
  $id, $version = $_ -Split " "
  $nupkg = $id + "." + $version + ".nupkg"
  $path = [IO.Path]::Combine($source, $id, $version, $nupkg)

  Write-Host "nuget.exe push -Source $destination ""$path"""
  & nuget.exe push -Source $destination $path
}