# .NET Core coverage with sonarqube (dotnet-coverage)

**URL:** <https://community.sonarsource.com/t/net-core-coverage-with-sonarqube-dotnet-coverage/80883>\
**Category:** SonarQube Server / Community Build\
**Tags:** coverage\
**Created:** [January 10, 2023, 6:50pm UTC](https://community.sonarsource.com/t/net-core-coverage-with-sonarqube-dotnet-coverage/80883 "2023-01-10T18:50:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AnilVinukonda](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/anilvinukonda/32/33881_2.png) [@AnilVinukonda](https://community.sonarsource.com/u/AnilVinukonda)\
**Post date:** [January 10, 2023, 6:50pm UTC](https://community.sonarsource.com/t/net-core-coverage-with-sonarqube-dotnet-coverage/80883/1 "2023-01-10T18:50:55Z")

</div>

Hello,

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.

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/8/7/873d458ea44280b3132b4986e20ad49de5ee3bbb.png)

 ![error message](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/1/d/1d67f9cabed49dcd5b78184fd37d3d3799c8fb04.png)

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [January 11, 2023, 3:01pm UTC](https://community.sonarsource.com/t/net-core-coverage-with-sonarqube-dotnet-coverage/80883/2 "2023-01-11T15:01:39Z")

</div>

Hi,

It looks like you’ve shared a screenshot of logs – and nobody in this Community likes to pretend they’re an [optical character reader](https://en.wikipedia.org/wiki/Optical_character_recognition).

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.

&nbsp;  
Ann

---

<div class="post-metadata">

**Author:** ![AnilVinukonda](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/anilvinukonda/32/33881_2.png) [@AnilVinukonda](https://community.sonarsource.com/u/AnilVinukonda)\
**Post date:** [January 11, 2023, 3:13pm UTC](https://community.sonarsource.com/t/net-core-coverage-with-sonarqube-dotnet-coverage/80883/3 "2023-01-11T15:13:22Z")

</div>

Hi Ann,

Thank you for your reply.

Regards,  
Anil.

---

<div class="post-metadata">

**Author:** ![AnilVinukonda](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/anilvinukonda/32/33881_2.png) [@AnilVinukonda](https://community.sonarsource.com/u/AnilVinukonda)\
**Post date:** [February 7, 2023, 2:45pm UTC](https://community.sonarsource.com/t/net-core-coverage-with-sonarqube-dotnet-coverage/80883/4 "2023-02-07T14:45:20Z")

</div>

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 :

```auto
dotnet sonarscanner begin /k:"<sonar-project-key>"
    /d:sonar.login="<sonar-token>"
    /d:sonar.cs.vscoveragexml.reportsPaths=$GITHUB_WORSPACE/tst/results.xml
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.

> **[.NET test coverage](https://docs.sonarqube.org/9.7/analyzing-source-code/test-coverage/dotnet-test-coverage/)**
>
> SonarQube supports the reporting of test coverage information as part of the analysis of your .NET project.

==\> We have “SonarQube.Analysis.xml” defined under : $github\_workspace/SonarQube.Analysis.xml

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

```auto
<?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> 
</SonarQubeAnalysisProperties>

```

Regards,  
Anil Kumar V

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [February 7, 2023, 4:36pm UTC](https://community.sonarsource.com/t/net-core-coverage-with-sonarqube-dotnet-coverage/80883/5 "2023-02-07T16:36:49Z")

</div>

Hi Anil,

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

&nbsp;  
Ann
