How do I host my own nuget v3 feed?
Asked Answered
S

4

7

My organization has several nuget v2 feeds (.net app consuming nuget.server) for our internally developed packages and to re-host third party packages (since our build machines do not have internet access and we audit what packages developers consume within our product and would like the builds to fail if we don't have a package).

Whenever I add any packages that require nuget client 3.0+ to my nuget servers, the nuget server crashes because it cannot read metadata from those packages. How do i host my own nuget v3 server / upgrade my existing nuget servers to be v3 compatible?

Supersensual answered 9/11, 2015 at 18:45 Comment(0)
C
2

I wrote a nuget server aspnetcore middleware recently.

Of cource the implementation is so foolish, ugly etc... link

You can set up it in the Startup.cs

public void ConfigureServices( IServiceCollection services )
{
    ...
    services.AddNugetServer(opt=>
    {
        opt.ApiKey = "This is a string used for adds or deletes your package(s)";
        opt.PackageDirectory = "/path/to/your/packages"; //default is current path + "/packages"
    });
    ...
}

public void Configure( IApplicationBuilder app, IHostingEnvironment env )
{
    ...
    app.UseNugetServer();
}

And visit http(s)://your-server-address[:port]/v3/index.json

Publishing:

dotnet nuget push -s http(s)://your-server-address[:port]/v3/package package.nupkg
Cornu answered 26/12, 2017 at 16:16 Comment(0)
N
1

I have had the same problem, and have done some research. You might already have solved Your problem, but here NuGet themselves lists a few alternatives to look into; both free and paid: Hosting Your Own NuGet Feeds

In short, the list is

  • Visual Studio Team Services
  • MyGet
  • Inedo's ProGet
  • JFrog's Artifactory
  • NuGet Server
  • Sonatype's Nexus

I have just tested ProGet, but that one seems not up to date with v3 even if it was easy to install and free.

I might just switch to the TeamCity native one, as soon as they get the feature to handle v3 feeds.

Currently I am testing NuGet Server that can be downloaded as package via

Install-Package NuGet.Server

in the Package-Manager in Visual Studio in a new, empty web application for .Net 4.5.x.

Nozzle answered 4/5, 2016 at 8:24 Comment(0)
G
0

I have check some products and my favourite is Azure DevOps Services.

Azure DevOps Services

✅ free (2GB Storage included)
✅ support symbols
✅ website with a search

BaGet Currently no stable release version is available (september 2019)

✅ free
✅ support symbols
✅ website with a search

NuGet Server

✅ free
❌ support symbols
❌ website with a search

MyGet

❌ free
✅ support symbols
✅ website with a search

Inedo's ProGet

❌ free
✅ support symbols
✅ website with a search

JFrog's Artifactory

❌ free
✅ support symbols
✅ website with a search

Sonatype's Nexus

❌ free
❌ support symbols
✅ website with a search

Migration script

$source = "http://oldnuget-server.mydomain.com/nuget"
$destination = "https://pkgs.dev.azure.com/MYCOMPANY/_packaging/MYCOMPANY/nuget/v3/index.json"

(& .\nuget.exe list -AllVersions -Source $source).Split([Environment]::NewLine) | % {
  $id = $_.Split(" ")[0].Trim()
  $version = $_.Split(" ")[1].Trim()

  $path = [IO.Path]::Combine("Packages", $id, $version, "${id}.${version}.nupkg")

  Write-Host "nuget.exe push -Source $destination ""$path"""
  & .\nuget.exe push -Source $destination $path -ApiKey XXXX-XXXXX
}
Geraud answered 20/8, 2019 at 7:48 Comment(0)
C
0

Consider using BaGetter. It has a stable release as of 2024 and supports v3, something that NuGet.Server does not. It's also able to mirror other NuGet providers' feeds.

Cao answered 13/9 at 7:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.