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
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.
- 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
- 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
- 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 )
- 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.
Visual Studio Integration
In visual studio you will need to add the new Package Server Source URL
- Open Package Manager Settings
- 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/"
- 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 )