Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 294
badazzhindu Avatar asked Nov 09 '15 18:11

badazzhindu


People also ask

How do I add NuGet feed to Visual Studio?

In visual studio, select Preferences from the menu bar. Select NuGet, and then select Sources. Select Add, and then enter your feed's name, the source URL, a userName (any string), and your personal access token. Select OK.

How do I use a NuGet V3 package feed in azure?

Now that the feed contains packages it can be used the same as any other NuGet feed. NuGet v3 feed URLs must contain the path full path to index.json, so for an Azure storage account it will look like this: The URL can be added to your NuGet.Config file, either for your project or to the machine wide NuGet config at %appdata/NuGet/NuGet.Config

How to host your private NuGet feed in Visual Studio?

Use Azure DevOps New Signature / Blog / Want to host your private NuGet feed? Use Azure DevOps When adding features to a project in Visual Studio, you can do so by directly referencing the libraries as individual dlls or a collection of dlls as a NuGet package.

How to set up NuGet Server?

Simply said, NuGet.Server makes a folder on the server available through HTTP(S) (specifically OData). It's easy to set up and is best for simple scenarios. Create an empty ASP.NET Web application in Visual Studio and add the NuGet.Server package to it. Configure the Packages folder in the application and add packages.

Which NuGet hosting products support remote private feeds?

There are also several other NuGet hosting products such as Azure Artifacts and GitHub package registry that support remote private feeds. Below is a list of such products: Artifactory from JFrog. Azure Artifacts, which is also available on Team Foundation Server 2017 and later.


2 Answers

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
like image 177
Reo Mai Avatar answered Oct 18 '22 04:10

Reo Mai


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.

like image 35
Tryggen Avatar answered Oct 18 '22 03:10

Tryggen