Code Coverage not working while integrating SonarQube with Azure DevOps


I have integrated SonarQube in my Azure DevOps build pipeline. I am using Dot Net core 2.1 based Web application with a test project having
some unit test cases as well.
I have configured my local machine (with Visual Studio 2019 Community edition installed) as the custom Agent for the Azure DevOps pipeline. I have installed Sonarqube on my local machine only.

When I trigger the build, it is executing successfully & I am able to see the SonarQube Analysis on the Sonar dashboard. But for
some reason it is showing code coverage as 0%. As per my understanding, Azure DevOps is generating coverage file with the
extension “.coverage” where as SonarQube expects the file with the extension as “.coveragexml”

Please help me to resolve this issue.


Hi @Prafull_Pandey and welcome to the community !

In order to make it work, you’ll need to have an instance of CodeCoverage.exe installed.

So you can either :

  • Upgrade your current Visual Studio installation to an Enterprise edition (or use a Microsoft hosted image, they run Visual Studio Enterprise in them)
  • Add the Visual studio Test Platform installer task to your build, convert manually tthe generated *.coverage file to *.coveragexml file with that task, and add the full path of it in the sonar.cs.vscoveragexml.reportsPaths additional property.