How to automate NuGet package creation using Jenkins?

Chervenkov picture Chervenkov · May 8, 2015 · Viewed 10.5k times · Source

For one of my projects I am using many dependencies in the form of NuGet packages. When I change any of them, I need to recreate the package and deploy it every time. We currently have Jenkins setup as our task runner. I was wondering is there a way to automate the package creation and deployment as a nightly job for example.

Answer

Anton Angelov picture Anton Angelov · May 8, 2015

You can create a new Jenkins job and add a windows batch step. There you can use the following command:

C:\J\Nuget\NuGet_2.81.exe pack “%WORKSPACE%\PhantomTube\PhantomTube.Core\PhantomTube.Core.csproj” –IncludeReferencedProjects  –Version %MajorVersion%.%MinorVersion%.%PatchVersion%%PrereleaseString% -Properties Configuration=Release

You can add some of the parameters as JOB's variables.

You can find more detailed tutorial here: http://automatetheplanet.com/create-jenkins-job-creating-nuget-packages/