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.
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.
You need to replace with your API key (you will get it from Admin > Manage Accounts > Accounts > Local Administrator screen) and URL.
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.
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.
And you can search / browse the package using Manage Nuget Packages for solution option, which will display a screen like this.
You can also install it via Package Manager console, where you need to provide a command like this.
Happy Programming :)