VSTS for beginners: improve quality with continuous integration in 3 easy steps

In this blog post we’re going to configure a build process in VSTS to enable continuous integration for our ASP.Net Core example web-app.
Continuous integration is a powerful technique to prevent merge-hell and improve quality on the “left” stages of our software production process. In the fast-paced world of development we want to merge into the main line of development the new developed features as soon as possibile to avoid open branches that will cause painful merges. If we keep our unit of work small and focused we’ll have great benefits.

In this tutorial we’ll start from scratch creating a new .net core 2 web-app and then we configure VSTS.

If you have a working project you can jump to the second step.

1. Create a .Net Core web-app

We open a PowerShell command line and create a new folder for our project. For this example I’ll use the name Parrish (the shoes company from the movie Jumanji).

>PS mkdir parrish-mvc

And then we turn this into a git repository:

>PS git init

We add a gitignore file into the root of the repository to commit into git only the meaningful files. We can use this one.

Now we create a standard .NET Core MVC project with the PowerShell command line:

PS> dotnet new mvc

Then we open the project with Visual Studio and hit F5. We can see the web app up and running.

Now we have our web-app that we want to build in an automated fashion on VSTS.

2. Upload the code to VSTS

To leverage VSTS features we need to upload our repo.

  1. We commit everything we’ve done with the commands
    git add .
    git commit -m "Init"

    With this commands we’re adding to the git index all the files we created and making the first commit with the “Init” message.

  2. We upload to VSTS with the commands:
    git remote add origin https://xxxxx.visualstudio.com/_git/ProjectName
    git push -u origin --all

The code is now on VSTS and we can browse like this:



3. Setup a Build Process

A Build Process is a set of tasks required to compile, test and validate our software project. In the old days all of this was done manually but thanks to solutions like VSTS (and many others on the market) we can automate this task and avoid manual steps. Automation is a powerful way to increase a team productivity and reduce errors. It also enforces a standard process.
Setting up a build process can be long and boring but VSTS is loaded with templates we can use to jumpstart the configuration.

We go in the “Build And Release” section of VSTS and search in the search-box for “core”. Our simple web-app is a ASP.Net Core App and we’ll find the right template for us named “ASP.NET Core”. We choose that template.


VSTS will show us a set of steps. The first one that we need to configure is the source of our source code that we want to build. We select VSTS git, our Parrish Shoes project and the master branch.
Since our project is not very complicated all other default values for the other steps are fine.


Now we need to setup a trigger to start a build every time a commit is pushed in the master branch. We go in the “Triggers” section and check the “Enable continuous integration” option.


We hit Save & queue to save the configuration and queue a build.

10VSTS gives us the feedback that a build has been queued.

11We can browse the builds and we can see the detail of the work in progress in the running agent. An agent is a server where the build process can be executed. VSTS provides us a default agent with some capabilities but we can create our own to better fit the needs of our complex real-life-company-enterprise project.


If the build is OK everything will turn green!
In this simple project we have no tests but the template is already configured to search for tests in our solution: as we can see there is a specific “Test” step.

13We also receive an e-mail as confirmation.14


In this blog post we created a simple .Net Core web-app from the command line and uploaded it to VSTS. That was our starting point to setup a build process that we created leveraging a template found in VSTS. Now our web-app is featured with a CI process that is a very good first step to protect the quality of our source-code.

2 pensieri riguardo “VSTS for beginners: improve quality with continuous integration in 3 easy steps”


Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo di WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...

Questo sito utilizza Akismet per ridurre lo spam. Scopri come vengono elaborati i dati derivati dai commenti.