Building a private nuget repository using Klondike

Posted by Anuraj on Tuesday, April 19, 2016

Visual Studio nuget Klondike

NuGet is a free and open-source package manager designed for the Microsoft development platform (formerly known as NuPack). Nuget is a great way to share packages in between teams. This post is about setting up your own nuget server for your company or team. This post is using Klondike, which is web application, instead of building my own using nuget.server package. Klondike is an asp.net web application you deploy to your own web server or to the cloud that works as a private NuGet package feed for storing private packages your organization creates. Klondike can also automatically restore packages sourced from 3rd party feeds, such as the nuget.org public feed, to keep your build server humming even when nuget.org is unavailable.

Please follow the steps to install Klondike in your local environment or azure. It is simple and straight forward.

  • First you need to download the binary zip from the Releases url.
  • Then you can modify the Settings.config. It is well documented, you can find configuration help as comments.
  • Finally create a site in IIS using a .NET v4.0 Integrated Pipeline application pool. Klondike works best deployed as a root application and is only supported in this configuration. I have created a new website with port 8081.

Klondike running in your local environment

You can publish a nuget package to the repository either using dropping the nuget package to the package directory (by default App_Data\Packages), and you need to Synchronize it using Admin menu or you can publish using the nuget.exe.

To publish a package using nuget you need to download the nuget.exe from nuget.org. The execute the following command.

nuget push MathLib.1.0.0.nupkg fcebc8ce-25ed-4eb6-ba33-5851bdaf5094 -Source http://localhost:8081/

You need to replace with your API key (you will get it from Admin > Manage Accounts > Accounts > Local Administrator screen) and URL.

Nuget Push command

Once you execute this command, message will be displayed like Your package was pushed. Now if you open your packages page, you will see the details of the package you pushed.

Packages details in Klondike packages

All the details displayed in the page is read from the nuspec file as part of the package.

To consume the nuget repository, you need to configure the URL in Nuget Package Sources, you can do it by Tools > Options > Open the Nuget Package Manager node. And select the Package sources option.

Configuring local package source

And you can search / browse the package using Manage Nuget Packages for solution option, which will display a screen like this.

Manage Nuget Packages for solution

You can also install it via Package Manager console, where you need to provide a command like this.

Install-Package MathLib -Version 1.0.0 -Source http://localhost:8081/api/odata

Happy Programming :)



Did you like this article? Share it with your friends

Facebook Twitter Google+ LinkedIn Reddit StumbleUpon



Subscribe


Copyright © 2017 - Anuraj P. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Hosted with ❤ by GitHub