Getting started: Azure DevOps CI/CD Pipeline for ASP.Net core – Part 1


Let’s get straight to the topic. Earlier days when we were developed a web application we need to execute a few steps before we get that into the production. No matter how big or small the fix or the feature or the application, it needs the same process to follow such as testing, building, creating an artefact, deploying to environments and finally to production.

But nowadays you don’t have to do those steps manually. Because there are few highly recommended tools in the market to make your life easier. Azure DevOps is one of its kind. Azure DevOps is a tool by Microsoft and it helps us as developers to automate our CI/CD pipeline. Or in other hands to bring our application-level changes as quick as possible to the production.

Wait!!!!!!, Now you wonder what is CI/CD. Simply it means;

  • CI  –  Continuous Integration
  • CD –  Continuous Deployment

In this part of the post, we will discuss the CI portion and in the next part, I will walk you through the CD poration. Then both articles together you will know something about CI/CD with Azure DevOps. Believe me, That something is a step higher than what you were yesterday.

Continuous Integration (CI)

What we are going to accomplish here with Continuous Integration (CI) Pipeline is that; anything we are committed to the remote repository will automatically trigger the application build operation to create artifacts which we can use in Continuous Delivery (CD) Pipeline. Let’s do this step by step for clear understanding.

1. Create an ASP.Net core web application

Purpose of this post is to set up a Continuous Integration (CI) Pipeline for your ASP.Net core application. Since I’m not going to tell you how to create an ASP.Net core web application, instead, I am going to use a template from Visual Studio.

Open Visual Studio and select an ASP.Net Core 3.0 with “Web Application” template which will create a sample core application with razor pages.


Then right-click on the application solution and click “Build Solution” and press F5 to run the application. The application will restore all missing components while you are building your application. If everything goes well, then you can see a web application like below,


2. Add your application to a version control system

Because we have a working web application, I am going to add that into a version control system. Note that we should have a version control system to set up a Continuous Integration (CI) Pipeline in Azure DevOps. Therefore I am going to use the inbuilt Azure DevOps version control system.

If you don’t have any Azure DevOps account yet, you can visit here to create a new Azure DevOps Account.  You are required to have a DevOps account to proceed with other steps in this guide.

First right-click on your solution and select “Add Solution to Source Control…” to add your solution into the local version control system. You can download “Githere if you don’t have any version control system in your local machine.


You can use the “output” window to see whether you have created your local git repository successfully or not.


Once you have created it successfully, go to the menu bar and select “Team Explorer” in the “View” menu. It will open the “Team Explorer” next to your “Solution Explorer” window.


In the “Team Explorer” window select “Sync” button as shown below. If you cannot locate these buttons select the “Home” button which is circled in yellow.


It will prompt you to select your remote repository. The first option is if you are using GitHub as your remote repository. But in this guide, we are going to use “Azure DevOps“. Therefore I select “Publish Git Repo” as I circled in yellow in below image.

You can use the third option if you have any other repository already configured with you.


It will prompt you to add your credentials and select your account. Use the same details you’ve used when you are creating your Azure DevOps account. If you haven’t created an account yet, first go to Azure DevOps and create a new account there.

As in below image, once you have authenticated properly, you can see your organization. Select appropriate organization from there. Then you can select “Advanced” if you want to add this repo inside a specific project. Otherwise, when you publish, It will automatically create a new project with the name as same as the repository name that you have given in the field of “Repository name“. Once everything is done click “Publish Repository


If everything goes well, you will see a message like below. You can select “See it on the web” link to navigate to you Azure DevOps page. Or you can use Azure pipeline to create your first Continuous Integration (CI) Pipeline from Visual Studio as in the image below.

In this post, I prefer to take you to the Azure DevOps page. So click on the web link.


3. Creating Azure DevOps Pipeline for Continuous Integration (CI)

After you have clicked the web link, you can see your Azure DevOps web as the image below. Now we are going to create our Continuous Integration (CI) Pipeline.

This is how you going to create your pipeline, you can click on “Set up build” to start your pipeline configuration.


The above button will bring you to the below page. From thatpage select “ASP.Net Core (.Net Framework)” as your pipeline configuration. In Azure DevOps, you have a lot of pre-defined YAML template to build an application.

You can explore more templates by clicking “Show more” button. Or you can create your own configurations if you are familiar with YAML.

We selected ASP.Net Core template because our application is an ASP.Net core application.


According to the selection above your YAML file will be like below. Now your YAML file going to do the charm for you. Let’s see how.

Hit “Save and run” to run your first build. This action will automatically save your YAML file to the selected branch. You can have a separate YAML file for each branch. We can use this file to configure our builds according to our organization requirements.


You can see your first Continuous Integration (CI) Pipeline job in below image. Then by clicking on the job itself, you can see more details about your building process.



Once everything you can see all the status like below.


Here I got a warning error because I haven’t created any test project for my application. We can ignore that warning at the moment. Overall our build is completed and successful.


That’s all we have to do. Now I can say that you have successfully configured your project to Continuous Integration (CI) Pipeline with Azure DevOps.

Wait!!!! We are not finished yet. We need to check whether this is working or not. let’s do a quick edit in our application like below. I just changed my application heading.


Then right-click in the solution and click “Commit” button. Add a comment and click “Commit All” as in the second picture.

Then finally as in the third picture, click “Sync” to sync your changes with the remote repository. That means with the Azure DevOps repository.  At this moment, our automatically configured Azure DevOps Pipeline should start a new job to build our application with new commit.

Once you have done with the commit, go to Azure DevOps Pipeline page and you will see there is another job in the queue which is already started the process of validating changes and creating artifacts.

If you can see a new job in the queue only by committing to master branch I can say we are success in configuring Continuous Integration (CI) Pipeline to our application.


Another amazing thing is that you will receive an email notification about your build status such as succeed, failed with other important details.


Wooop! You have completed the Continuous Integration (CI) Pipeline for your application. Please note that this is a getting started guide. Later you can know how to configure your builds according to your organization requirements by changing YAML configurations.

In the next post, I am going to use artifacts which are created by the above process to configure Continuous Delivery (CD) Pipeline.

Thank you for reading the post. Please contact me for any missing pieces in the Continuous Integration (CI) Pipeline.

Happy Coding Guys!!!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s