Don't WET the code, initialize your private NuGet repo with VSTS

Ever since we have started growing at TrueLime, it has become harder to keep up with all the cool things our dev teams create. Even though we got the knowledge sharing flowing via chapter meetings and lunch-and-learn sessions, this did not prevent us from the "writing everything twice" concept. In this post I will highlight the steps to get your own NuGet repo up and running.

Before we begin

If you are new to VSTS and Continuous Delivery, I recommend my blog post: How to setup Continuous Delivery using VSTS within minutes. The purpose is to get a brief understanding of the VSTS platform and how easy it is to get a release pipeline up and running. This will form the basis of getting our NuGet repo alive and kicking.

Package Management

The first thing we need to do is install Package Management from the Visual Studio Marketplace.

Package Management from the Visual Studio Marketplace

This extension will take a lot of work out of your hands. Plus it's not only free for the first 5 (basic) users, it's also free for MSDN subscribers and Visual Studio Enterprise subscriptions. That's why I definitely recommend to install it!

Next up I recommend you to create a new build definition and enable the Continuous Integration trigger. The basic Visual Studio build process template should do, just make sure you go through the list of tasks and tweak the according to your needs. Finally add the NuGet Packager and NuGet Publisher tasks to complete the build. Your build definition will look something like:

Build definition of our NuGet repo

Versioning the NuGet packages

From the previous screenshot you might wonder what the GitVersion task is. GitVersion helps you to "control" the version number of your NuGet packages. The setup is quite simple, install the GitVersion package from the Visual Studio Marketplace and add and configure the task in the build definition.

GitVersion from the Visual Studio Marketplace

Finally grab the GitVersionTask NuGet package and add it to your Visual Studio project.

Tip: for more details on GitVersion I recommend the following article: Versioning NuGet packages in a continuous delivery world: part 3

Wrap up

This post just scratches the surface on what you can do with Package Management in VSTS. My main goal is to get you enthusiastic about the VSTS platform, get fast results and improve your coding quality.

I for one am pretty happy with the result :)

Private NuGet repo