If your team publishes internal .NET libraries, running a private NuGet feed gives you control over package distribution, versioning, and access. This guide explains three self-hosted approaches—local folder sources, NuGet.Server, and NuGetGallery—and shows how to publish and consume packages with each.
Originally published on 2015-11-21; fully revised and updated.

Choose the right hosting option
The best private feed setup depends on how much management, UI, and automation your team needs.
| Option | Setup complexity | Package publish method | Web UI | Best for |
|---|---|---|---|---|
| Local folder source | Low | Copy files or nuget add to a folder/share | No | Small teams and simple internal sharing |
| NuGet.Server | Medium | nuget push to HTTP endpoint with API key | Minimal | Internal feeds with basic server capabilities |
| NuGetGallery | High | Server-backed publish flow | Yes | Organizations needing a full package portal |
Option 1: Local file-based package source
A folder source is the fastest way to share packages. Packages are stored as .nupkg files on disk or a network share. It is easy to start, but there is no built-in web feed UI or server-side management layer.
mkdir -p /srv/nuget-feed
nuget add MyLibrary.1.0.0.nupkg -Source /srv/nuget-feed
nuget list -Source /srv/nuget-feedCode language: PHP (php)
Option 2: Host NuGet.Server in an ASP.NET app
This is the closest match to the original tutorial: create an empty ASP.NET web app in Visual Studio, install NuGet.Server, and use the generated /nuget endpoint as a private package source.
Minimal setup flow
- Create an empty ASP.NET web application in Visual Studio.
- Open Package Manager Console and install
NuGet.Server. - Run the app and browse to
http://localhost:<port>/nuget. - Configure an API key in app settings, restart, then publish with
nuget push.
Install-Package NuGet.ServerCode language: CSS (css)
<appSettings>
<add key="apiKey" value="CHANGE_ME" />
</appSettings>Code language: HTML, XML (xml)
nuget setApiKey SECRETKEY -Source http://localhost:42386/nuget
nuget push MyLibrary.1.0.0.nupkg -Source http://localhost:42386/nuget
nuget list -Source http://localhost:42386/nugetCode language: PHP (php)
Option 3: Run NuGetGallery for a full portal experience
If you need a richer, gallery-style package experience, use NuGetGallery. The original post pointed to this repository. Compared with NuGet.Server, it is a larger deployment with more operational overhead.
git clone https://github.com/NuGet/NuGetGallery.gitCode language: PHP (php)
Package publish and consume workflow
flowchart LR
A[Developer creates nupkg] --> B[Publish package]
B --> C{Feed type}
C --> D[Folder source]
C --> E[NuGet.Server]
C --> F[NuGetGallery]
D --> G[Consumer restores package]
E --> G
F --> G
G --> H[Build and release]
Client configuration example
To make a private feed available to developers and CI agents, add it to NuGet.Config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="PrivateFeed" value="http://nuget.example.com/nuget" />
</packageSources>
</configuration>Code language: HTML, XML (xml)
Best practices and common pitfalls
- Start simple: use a folder source or NuGet.Server first, then move to NuGetGallery only if you need portal features.
- Secure publishing endpoints with strong API keys and controlled network access.
- Standardize feed configuration in source-controlled
NuGet.Configfiles. - Define package retention and cleanup policies to avoid uncontrolled storage growth.
- Validate commands and app settings against the exact NuGet tooling and server version you run.
I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services — all in one place.
Explore Hospitals