Target. Display code coverage information on your own .NET Core project.

First, create a build pipeline in your Azure DevOps.

If you are using the classic designer, you need to add new .NET Core command line step.

Make sure you publish the test result.

As for the Arguments input, insert:

--configuration $(buildConfiguration) --collect "Code coverage"

Or if you are using YAML:

Add the task: DotNetCoreCLI@2

- task: DotNetCoreCLI@2
    displayName: dotnet test
      command: test
      arguments: --configuration $(buildConfiguration) --collect "Code coverage"
      testRunTitle: TestsResult

And always use Windows platform to run the build. Do NOT run in Linux because the code coverage generator still doesn't support Linux.

Now save and run the pipeline.

When the build finish, you will see the code coverage and test result here.

In my example, my code coverage is 87%.

To get the badge URL, first, copy the following parts in your URL.

Copy the three parts of the URL. Like in my example:

  • A is aiursoft
  • B is star
  • C is 5

Now copy the following markdown text:

![Azure DevOps coverage]({{A}}/{{B}}/{{C}})

Change the A, B and C to the value you copied. Like:

![Azure DevOps coverage](

Now save that in your

All done. Enjoy coding!