badazzhindu
badazzhindu

Reputation: 933

How do I host my own nuget v3 feed?

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?

Upvotes: 7

Views: 2098

Answers (4)

Rekkon
Rekkon

Reputation: 325

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.

Upvotes: 0

live2
live2

Reputation: 4265

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
}

Upvotes: 0

Reo Mai
Reo Mai

Reputation: 36

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

Upvotes: 2

Tryggen
Tryggen

Reputation: 163

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.

Upvotes: 1

Related Questions