In this tutorial, we are going to cover a simple example of continuous integration and deployment in devops using Visual Studio 2019. It provides us a great help for creating a better project with a lower maintenance cost and higher customer satisfaction. This is very important for every application. So, first-of-all, we will see how to create a project in Azure DevOps, then we will see how to create a new Git repository and clone it locally, and then we will see how to integrate it with Visual Studio 2019, and then we will see how to create a commit using Visual Studio 2019, and then we will see how to create a new branch, and then we will see how to merge changes and resolve conflicts, and then finally we will see how to build pipeline.

What will you learn in this tutorial?

We will learn lots of things in this tutorial as you do see in below list.

How to create a project in Azure DevOps?

How to create a Git repository and clone it locally?

How to integrate it with Visual Studio 2019?

How to create a commit?

How to create a new branch?

How to do merge changes and resolve conflicts?

How to build Pipeline?

Previous Tutorials for Deployment

Continuous integration and Continuous Deployment in DevOps using Visual Studio 2019.

Let’s start to learn about Continuous integration and continuous deployment in DevOps using Visual Studio 2019 in step by step.

Step # 1: How to Create a project in Azure DevOps?

In this step, we will see how to create a project in Azure DevOps. So, first-of-all, go to this link ( https://visualstudio.microsoft.com/team-services/ ) and then click on Get Azure DevOps free button.

Then you will see a login page. So, sign in with your account credentials. If you don’t have your account then create new one account.

Now, you will see a dashboard of Azure DevOps. So, click on the Create Project button.

Note: – If you are using it as first time then you may need to create a new organization within your Azure DevOps account. So, to do this, just click on the New Organization link from left sidebar and then create a new one. Here in this tutorial, I am not creating a new organization because i have done it already.

So, after clicking on the Create Project button, now you will see a new popup window with the name of “Create New Project”. So, enter the Project name, Description, Visibility and then select Git from Version control dropdown and then select scrum from Work item process dropdown and then click on the Create button as you do see in the below screenshot.

So, creating a new project in Azure DevOps part is completed. And you will see a dashboard as you do see below in the screenshot. Now, you are able to manage boards, Repos, Pipelines, Test plans, and Artifacts.

Step # 2: How to Create a Git repository and clone it locally?

Now, in this part we will see how to create a Git repository and then clone it locally. So, go to Azure DevOps project dashboard which we have created recently and then click on Repos from the sidebar and then click on Files and then you will see a new page where you will see different options as you do see below.

Now, select Visual Studio from the dropdown as you do see below.

Now, you will see a new popup will show. So, select Microsoft Visual Studio Web Protocol Handler Selector and then click on the OK button. Then it will open Visual Studio 2019 and then a new popup with the name of “Azure DevOps” as you do see below. So, here you will see option where you will set your local path. After setting the local path, now click on the Clone button. And it will start downloading.

It will take some to download the project in local path.

Step # 3: How to create a first Commit?

Now, in this step we will see how to do a commit using Visual Studio 2019. So, go to visual studio 2019 and then Team Explorer and then click on the Settings and then click on the Repository Settings link and then go to Ignore & Attribute Files section and then click on Add for each file.

Now, go to the Home section for Team Explorer and then click on the Changes and then write the comment for your first commit in the comment section and then click on the Commit Staged button.

Now, our first commit has been created locally. So, click on the Sync link.

Now, click on the push link.

Now, go to Azure DevOps project dashboard and then go to Repos and then you will see both files are uploaded successfully.

Now, we have completed this part successfully.



Step # 4: How to create a new branch using Visual Studio 2019?

Now, in this step, we will see how to create a new branch using visual studio 2019. So, go to Visual Studio 2019 and then go to Team Explorer – Home and then click on the Branches link.

Now, click on the New Branch link as you do see in the below.

Now, enter the name of branch and then click on the Create Branch button.

It will create a new branch with the name Test as you do see below in the below screenshot.

Step # 5: How to do merge changes and resolve conflicts?

In this step, we will see how to merge changes and then we will see how to resolve conflicts. To do this, we need to add a new file in our project and push it to server.

So, go to local project repository and create a new file with the name (TestFile.txt). Then go to Team Explorer – Home and then go to Changes and then enter comment and then click on the Commit All button and then click on the Sync link and then click on the Push link.

Now, go to Azure DevOps project dashboard and then Files and then you will see the TestFile is uploaded successfully.

Now, update the TestFile.txt both on the server side and the local repository. Now, go to team explorer and then changes and then push it again. Now, you will get an error. So, click on the Pull link and then you will get the server changes. So, click on the Conflicts link.

Now, you will see a list of conflicting files. So, click on the file which you want to resolve and then click on the Merge button.

Now, after clicking on the Merge button, it will open tab within the visual studio with both server and local changes. Now, check the checkbox which change you want to keep ( You can check both). And then click on the Accept Merge button.

Now, go back to Team Explorer and then click on the Commit Merge button.

Now, write the comment and then click on the Commit Staged button and then it will merge it locally.

Now, click on the Sync link and then click on the Push link.

Then you will see a message which will show you the file has been successfully pushed.

Step # 6: How to Build Pipeline using Azure DevOps?

In this step, we will see how to build pipeline using Azure DevOps. So, go to Azure DevOps project Dashboard and then click on the Pipelines from the sidebar and then click on the New Pipeline button.

Now, click on the Use the classic editor link.

Now, select Azure Repos Git and then select Team Project from the dropdown and then select Repository from the dropdown and then select branch and then click on the Continue button.

Now, select ASP.NET Core and then click on the Apply button.

Now, click on the Get sources link and then choose source, Repository, Branch and etc.

Now, click on the Triggers from the menu and then check the Enable continuous integration checkbox. And then click on the Save & queue link to save.

Now, it will open a new popup window with the name of Save build pipeline and queue. So, now click on the Save & queue button.

So, this part has been completed and the build will automatically be triggered each time code is committed to the repository.

Step # 7: How to create a release pipeline?

In this step, we will see how to create a very simple release pipeline. So, go to Azure DevOps and then go to project Dashboard and then go to Pipelines and then click on the Release link.

Now, click on the New Pipeline button and it will open a new popup window. So, then select Empty Job and then click on the Apply button.

Now, click on the Add link from Artifacts.

Now, you will see a new popup with the name of the Add an artifact. Now, select Source type and then select project and then select source from dropdown and then click on the Add button.

Now, the artifacts section updates to display the changes.

Now, click on the lightning bolt icon to enable the continuous deployment.

Now, it will open a new popup window with the name of Continuous deployment trigger. So, now enable the radio button for continuous deployment trigger. Then click on the Add button from build branch filters and then select the Type and Build branch and then close this popup.

Now, click on the Save button from the upper menu. So, the release pipeline is created successfully.

In the next tutorial, we will see how to deploy it to azure.

Thank you for reading. Please keep visiting and sharing!

Note:- If you found this blog helpful then: Buy me a coffee If you found this blog helpful then: