Click here to Skip to main content
15,896,727 members
Articles / NuGet
Tip/Trick

Create Private Nuget Server With Klondike Server

Rate me:
Please Sign up or sign in to vote.
4.47/5 (6 votes)
15 Nov 2016CPOL2 min read 13.2K   68   5  
Publish a package file into a package server and consuming it.

Introduction

Nuget server and nuget packages are essential nowadays don´t lose DLL´s anymore! Noooo..not with me, not today !! 

You have your project done...and now ? how to create a package ? how to share it with your team?

So, what you want is create a package file (*.nupkg) share it with your team using a private nuget server and start consuming it in other projects.  

There are many Private Nuget Servers ( Microsoft Nuget Server ; MyGet ) this article will focus on Klondike Nuget Server.

More information on GitHub: https://github.com/themotleyfool/Klondike

Downloads

Deploying Nuget Server on Shared Machine 

Create a IIS Site using .Net Framework v4.0 with Integrated Pipeline Mode, I created my with the domain name nuget.domain.com on port 8081.

Image 1

  • Inside the project you will find a Settings.config file with some variables and you can change it as you like.

 

Creating Nuget Package File

  1. To create the package file you will need to add to your project a *.nuspec file with metada information I will show you my example but this is customized and you can get more information about this file in here https://docs.nuget.org/ndocs/quickstart/create-and-publish-a-package

Image 2

  1. Create an empty folder and put the nuget.exe file and the GenerateNugetPackageAndPublish.bat inside.
  • Open the GenerateNugetPackageAndPublish.bat and edit the following variables:

 ::Set Project Settings
SET SolutionName = Your Solution Name.
SET ClientSdkCsProj = Relative path from the project where nuspec file exists to the nuget.exe file.
SET LocalRepositoryFolder = Path where nuget package file and pdb file will be created.

  • Locate my API key value ( 4c52801b-78d6-4117-bd00-906bf6527ce1 ) and replace it by yours.

How to get your own value ? you will get it from Admin > Manage Accounts > Accounts > Local Administrator screen locally in your nuget server ( http://nuget.domain.com:8081 )

Image 3

  • After this you are able to create the nuget package and automatically deploy it to the server. Then run the GenerateNugetPackageAndPublish.bat and you will see your package in the server.

Image 4

Visual Studio Integration

In visual studio you will need to add the new Package Server Source URL

  1. Open Package Manager Settings

Image 5

  1. Add a New Package Server Name
  • Edit the Field Name: (choose the name you want to be shown on package source drop down list in Manage Nuget Package Visual Studio Interface )
  • Edit the Field Source: With the Url + Port + "/api/odata/"

Image 6

  1. Now you should be able to find your package available and ready to install (you should open Manage Nuget Package with mouse in top of a project if you open it in top of solution maybe the package will not be available )

Image 7

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Portugal Portugal
Software Engineering Lead and Technical Scrum Master


Comments and Discussions

 
-- There are no messages in this forum --