Import packages from a local feed
Local feeds let you use a folder as a NuGet package source.
info
Please refer to the BaGetter vs local feeds page for reasons to upgrade to BaGetter.
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 BaGetter 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
}