Creating A Local NuGet Package Repository

This article will show you how to create a Local NuGet package repository and consume packages from it.

NuGet is a simple and convenient way to do this via a graphical user interface or a PowerShell-based command line named Package Management Console. I am going to create a Local NuGet package repository and consume packages from it. The steps are below, along with screenshots.

Creating a Local NuGet Package Repository

We create a new class that we will reuse in other projects,
 
Creating a Local NuGet Package Repository
 
Build the project, and we can see the .nupkg file that is generated.
 
Creating a Local NuGet Package Repository
 
We can find these files that begin at the root of the project by navigating to C:\Users\admin\Desktop\NugetPackageProject\NugetPackageProject\bin\Debug
 
Creating a Local NuGet Package Repository
 
Let's configure Visual Studio to configure this new repository. Navigate to Tools | NuGet Package Manager | Package Manager Settings | Package Sources,
 
Creating a Local NuGet Package Repository
 
Let's add a name to this repository,
 
Creating a Local NuGet Package Repository
 
Let's place the NuGet package we just created,
 
Creating a Local NuGet Package Repository
 
Right-click on the root project in Solution Explorer and select Manage NuGet Packages to open the NuGet Package Manager.
 
If we open the Package source drop-down list in the top-right corner, we can see our new package repository,
 
Creating a Local NuGet Package Repository
 
Creating a Local NuGet Package Repository
 
Now let's install this package in the current project by clicking on the Install button; the following dialog box will appear,
 
Creating a Local NuGet Package Repository
 
Creating a Local NuGet Package Repository
 
After having created our own NuGet package by following the Creating a NuGet package recipe, we will publish it in the NuGet public repository, but we have created an account on the NuGet website.

Up Next
    Ebook Download
    View all
    Learn
    View all