Publishing a Private NuGet Package

I’ll go through how I went about publishing a private NuGet package folder accessible to Visual Studio. This will let you use the Manage Nuget Packages feature of Visual Studio without publishing your code publicly. If you use a shared location, other users can use it internally as well by following the same setup. I’ll then tell you how to publish to this folder after building a release of your project.

Enable search of private Nuget package source

Pick a shared folder on your network to host your private Nuget packages.

In Visual Studio choose to Manage Nuget Packages. This is available by right clicking your current open project. Note “Package source” in upper right of manager. By default it will point to We want to create our own private source and add it to the list.

Select the gear icon next to “Package source” drop down. Click the plus sign to add a source. Add a name “ex: My Company” and click the ellipses to browse to the network folder and select the shared folder you identified.

Example: We have one drive and a shared business folder mapped to local D drive.

D:\OneDrive\Business\My Company, LLC\Owner Name – Shared\nuget

Choose the Update button.

You can now search that directory for your private Nuget packages. It is empty right now or you already know what you are doing.

Create a private Nuget package and publish to this new source.

Download nuget.exe from This is NOT an install. Place the file in C:\Program Files (x86)\NuGet. Update your computers path variable to include this location.

Close and reopen Visual Studio.

Open your project and choose properties. Select the Package tab and update the properties for your package. You must ensure the Package id is unique across nuget sources.

Select Generate NuGet package on build or you can choose the Pack command by right clicking the project.

Place your project in Release mode and build. There should be a .nupkg file in the bin/release folder of your project.

Open Package Manager Console and change directory to the folder that contains the package file, .nupkg.

Issue the following command as described here

PM> nuget add new_package.1.0.0.nupkg -source \\myserver\packages


PM> nuget add MyCompany.Utilities.MyProject.1.0.0.nupkg -source "D:\OneDrive\Business\My Company, LLC\Owner Name - Shared\nuget"

Now choose a different project and manage Nuget packages for that project. Change the package source (default is to the desired location. Ex. My Company. Doing a search should show the newly added package.

Hopefully this guide for publishing a private NuGet package will help your business create reusable code without putting it out for the whole world to access.

Leave a Reply

Your email address will not be published. Required fields are marked *