Configure Your own Nuget Server

If you work in a team or maintain multiple .NET projects, you might have come under situation where you have to write the same common code for each of your project. In such situation, the best option for you is to create your own nuget package and hosting it to your own private NuGet feed. This can make package sharing cleaner, faster, and more secure. Instead of passing around .nupkg files or depending on public feeds, you can keep all internal libraries in one central place, your own NuGet server.

In this post, I’ll walk you through several ways to configure your own nuget server using available options:

  • Local folder feed
  • NuGet.Server (IIS-hosted)
  • NuGet Gallery (advanced, self-hosted option)

Prerequisites

Before setting up your server, make sure you have:

  • .NET Framework 4.5+ (or .NET Core if using NuGet Gallery)
  • Visual Studio 2015/2017
  • NuGet.exe (optional but recommended)
  • IIS (if hosting a web-based feed)

Option 1: Local Folder Feed (Simplest Method)

This is the easiest way to host a private repository—no server required.

Step 1: Create a folder

Create a folder anywhere on your machine or network share:

C:\NuGetRepo\

Step 2: Configure this folder as a package source

In Visual Studio:

  1. Go to Tools → Options
  2. Expand NuGet Package Manager
  3. Select Package Sources
  4. Add a new source:
    • Name: LocalRepo
    • Source: C:\NuGetRepo\

Step 3: Add your nuget packages

Just drop your .nupkg files into the folder.

Step 4: Use it

The feed now appears in the Visual Studio package manager.

Pros: Instant setup, no software required
Cons: No upload interface, no search, just a folder


Option 2: Hosting a Private Feed Using NuGet.Server (IIS)

Best for organizations / teams

NuGet.Server is a lightweight web-based NuGet feed you can host on IIS. This was the most popular approach around 2018.

Step 1: Create an ASP.NET Web Application

  1. In Visual Studio, create a new ASP.NET Web Application (.NET Framework).
  2. Choose the Empty template.

Step 2: Install NuGet.Server

Open Package Manager Console:

Install-Package NuGet.Server -Version 3.4.1

This adds everything needed to turn your app into a NuGet feed.

Step 3: Set your packages directory

By default, NuGet.Server uses the /Packages folder inside the project.

You can change this in Web.config:

<add key="packagesPath" value="C:\NuGetPackages" />

Step 4: Build & Publish to IIS

  1. Right-click the project → Publish
  2. Choose IIS, local or remote
  3. Publish the site

Step 5: Test the feed

Open a browser and navigate to:

http://yourserver/nuget

You should see a simple feed page showing your server is running.

Step 6: Add packages using NuGet.exe

Use the push command:

nuget push MyLibrary.1.0.0.nupkg -Source http://yourserver/nuget -ApiKey yourkey

NuGet.Server treats any API key as valid unless you configure one in Web.config.

Step 7: Add the feed to Visual Studio

In Tools → Options → NuGet Package Manager → Package Sources:

  • Name: CompanyFeed
  • Source: http://yourserver/nuget

Now your private NuGet server behaves just like nuget.org.


Option 3: NuGet Gallery (Advanced, Full Web App)

If you need a full-featured server with:

  • Web UI
  • User accounts
  • Package upload via website
  • Searching & filtering
  • Admin dashboard

…then NuGet Gallery is the official open-source implementation.

It’s more complex and requires Azure or an IIS + SQL Server environment, but is closest to running your own “mini nuget.org”.

Setup instructions include:

  • Clone the NuGet Gallery GitHub repo
  • Configure storage (Azure or filesystem)
  • Configure a SQL database
  • Deploy via Azure App Service or IIS

This option is best for enterprises or larger teams.