DevOps Part One - Continuous Integration With ASP.NET Core

In this article, I will be explaining more about continuous integration and how to apply it to your .NET Core projects using Azure Pipelines.
 
Related Articles 

What is continuous integration?

Continuous Integration is a development practice that integrates the code into a shared repository each time a commit is pushed by any member of the development team. It makes an automated build and you may use tools to check your code, presenting problems as soon as they appear.

Why use continuous integration?

  • Quicker integrations
  • To have a solid repository
  • Use unit tests to validate your business rules
  • Catch problems as soon as they begin to be problems
  • Increase project status visibility
  • Make use of tools to check your code quality

What is Azure Pipelines?

"Azure Pipelines is a cloud service that you can use to build and test your code project automatically and make it available to other users. It works with just about any language or project type.

Azure Pipelines combines continuous integration (CI) and continuous delivery (CD) to constantly and consistently test and build your code and ship it to any target."

Why use Azure Pipelines? 

  • Accepted languages: Python, Java, PHP, Ruby, C#, and Go.
  • Accepted application types: Java, JavaScript, Python, .NET, PHP, Go, XCode, and C++.
  • Integrates with: GitHub, Azure Repos, Bitbucket, and Subversion.
  • Accepted targets to deploy the code: container registries, virtual machines, Azure services, any on-premises or cloud target.
  • Type of packages produced: NuGet, npm, Maven packages or you can use any other package management repository of your choice.

How to apply continuous integration to your .NET Core projects using Azure Pipelines?

  1. I will use my previous project as a base project. You can find it here.

    Project in Azure DevOps Repos.

  2. You need an Azure DevOps organization. If you don't have one, you can create one for free

    Continuous Integration - Using Azure Pipelines with ASP.NET Core

    Continuous Integration - Using Azure Pipelines with ASP.NET Core

  3. Create a new project inside this organization.

    Continuous Integration - Using Azure Pipelines with ASP.NET Core

    You may access the one created for this article - https://dev.azure.com/thiagovivas/AzurePipelines 

  4. Have your code repository aligned,

    Continuous Integration - Using Azure Pipelines with ASP.NET Core

    Here, I have my code uploaded in the same project that I created before but you may use your code in GitHub as well.

  5. Create the pipeline.

    Continuous Integration - Using Azure Pipelines with ASP.NET Core 
Select your GitHub repository here, but as we already uploaded our code in the Azure Repos, we are using the "Azure Repos" option.
 
Continuous Integration - Using Azure Pipelines with ASP.NET Core
Continuous Integration - Using Azure Pipelines with ASP.NET Core 
Now, we have the yml file. Push the "Run" button. (Nothing has to be edited here).
 
Continuous Integration - Using Azure Pipelines with ASP.NET Core 

It is going to execute the first build.
 
Continuous Integration - Using Azure Pipelines with ASP.NET Core 
 
Every commit pushed to the repository is going to integrate automatically and build the new merged code.
 
Continuous Integration - Using Azure Pipelines with ASP.NET Core 
 
Continuous Integration - Using Azure Pipelines with ASP.NET Core
 
Continuous Integration - Using Azure Pipelines with ASP.NET Core 
 
Congratulations! You have successfully applied continuous integration to your .NET Core projects using Azure Pipelines.
 
External sources
  • https://www.thoughtworks.com/continuous-integration 
  • https://azure.microsoft.com/en-us/services/devops/pipelines/


Similar Articles