Azure DevOps —Build/Test/Collect Test Coverage and Publish Your Net 5 App

Norbert Dębosz
2 min readOct 7, 2021

--

Let’s answer a question about how easy and fast you can set up your own Azure CI/CD pipeline.

Why even bother to create azure pipelines?

  • Saving a lot of time as it can automate the whole process from pushing code to branch until release it to release server.
  • Making applications more resilient to bugs by catching them before release.
  • Making the release process resilient to human error as it can be fully automated.
  • Create a self-documentation of releases/builds etc that can be used for reports.
  • And much more…

Our pipeline will consist of 5 steps:

  • Restore — restore all NuGet packages used in the solution.
  • Build — Build a code to check if there is any build error.
  • Test — Run all Unit/Integration tests and see a result. Fail if at least one test fails.
  • Collect Tests Results — test results can be later used by external tools like Sonar Cube etc to provide code quality checks.
  • Publish — Publish source code ready to release to server.
Pipeline code

To be able to get a code coverage report you will have to install two extra NuGet packages in your Net 5 application shown below.

Summary

Azure DevOps is a powerful tool that makes work with CI/CD a pleasure.
With the above pipeline, you are able to configure your first full pipeline in just a couple of seconds. Feel free to use it.

--

--

Norbert Dębosz
Norbert Dębosz

Written by Norbert Dębosz

Solution Architect | Tech Lead | .Net Developer who searches for the perfect balance between business values and code quality.

No responses yet