.NET Core coverage with sonarqube (dotnet-coverage)


I am trying to implement " .NET test coverage" on SonarQube using the coverage tool : dotnet-coverage. I am not sure how this can be implmented.
I tried to follow the documentation however my workflow is not successful, Could any one help on this.


It looks like you’ve shared a screenshot of logs – and nobody in this Community likes to pretend they’re an optical character reader.

Typically log screenshots are nearly impossible to read. From what I can tell from your second screenshot, the error you’re getting is coming from trying to generate the coverage report, not from analysis. Thus, it’s out of scope for this community.


Hi Ann,

Thank you for your reply.


Hello Team,

I have run tests and have “results.xml” saved under : $GITHUB_WORSPACE/tst/results.xml

I am not able to execute dotnet coverage using the below command :

dotnet sonarscanner begin /k:"<sonar-project-key>"
dotnet build --no-incremental
dotnet-coverage collect 'dotnet test' -f xml  -o 'coverage.xml'
dotnet sonarscanner end /d:sonar.login="<sonar-token>"

Could you please help us how we can generate " .NET test coverage" results in sonarqube.

I tried the below documentation however I was not able to succeed.

==> We have “SonarQube.Analysis.xml” defined under : $github_workspace/SonarQube.Analysis.xml

==> Our “SonarQube.Analysis.xml” is defined as below :

<?xml version="1.0" encoding="utf-8" ?>
<SonarQubeAnalysisProperties  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.sonarsource.com/msbuild/integration/2015/1">

  <Property Name="sonar.host.url">https://sonarqube.*****-*****.de/</Property>
  <Property Name="sonar.exclusions">./BuildScripts/**,./DatabaseMigrations/**</Property>
  <Property Name="sonar.cs.vstest.reportsPaths">tst/results.xml</Property>
  <Property Name="sonar.cs.vscoveragexml.reportsPaths">results.xml</Property> 

Anil Kumar V

Hi Anil,

Can you provide the full, text log of the step that’s not working?