Private NuGet Package Publishing

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 nuget.org. 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 “My Company” and click the elipses 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. ITs 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 https://www.nuget.org/downloads. 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 https://docs.microsoft.com/en-us/nuget/hosting-packages/local-feeds.

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

Example:
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 nuget.org) to the desired location. Ex. My Company. Doing a generally search should show the newly added package.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s