VSTS for Beginners: Improve Quality With Continuous Integration in 3 Easy Steps

DZone 's Guide to

VSTS for Beginners: Improve Quality With Continuous Integration in 3 Easy Steps

Take a look at how to make use of VSTS to easily set up a continuous integration pipeline for your next ASP.NET Core project.

· DevOps Zone ·
Free Resource

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 possible 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. Set Up 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 an 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 set up 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.

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

We 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.

We also receive an e-mail as confirmation.


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 set up 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.

devops ,asp.net core ,vsts ,tutorial ,continuous integration ,pipelines

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}