SonarQube not showing the "Lines Covered"

Hello Team,
I am using Community Edition Version 10.1 (build 73491) and am triggering the Sonar scan via Jenkins (via JenkinsFile). The command that I am using is (in JenkinsFile):

${DOTNET_SONARSCANNER_EXE_LOCATION} begin /k:"xxx" /s:"${localDirectory}\\SonarQube.Analysis.xml" /d:"sonar.verbose=true" /d:"sonar.cs.vscoveragexml.reportsPaths=.\\CoverageReports\\coverage.xml" /d:"sonar.nodejs.executable=${NODE_EXE_LOCATION}"

dotnet build ${localDirectory}\\xxx.sln --no-incremental

${DOTNET_CODECOVERAGE_EXE_LOCATION} collect "dotnet test ${localDirectory}\\xxxTests\\xxxTests.csproj" -f xml -o ".\\CoverageReports\\coverage.xml"


I referred the dotnet-coverage section of the following url : .NET test coverage

The scan happens successfully and in its report, it highlights other metrics, like Hotspot, vulnerabililities, and so on. However, the Code coverage always point to 0.0% (on new and overall code)

I already have an another CI (GoCI) and it show that 70% of the code is covered. However the same does not happen in Sonarqube. It just does not show the ‚ÄúLines Covered‚ÄĚ (in green color, I remember) and just shows 0.0%.

I am not sure what I am doing wrong. Request you to kindly assist me on the same. If your require anything please do let me know.


Hello Team,
Can anybody please assist on this as I am badly stucked?


Welcome to the community!

Please share verbose logging.

Share the Scanner for .NET verbose logs

  • Add /d:"sonar.verbose=true" to the‚Ķ
    • SonarScanner.MSBuild.exe or dotnet sonarscanner begin command to get more detailed logs
      • For example: SonarScanner.MSBuild.exe begin /k:"MyProject" /d:"sonar.verbose=true"
    • ‚ÄúSonarQubePrepare‚ÄĚ or ‚ÄúSonarCloudPrepare‚ÄĚ task‚Äôs extraProperties argument if you are using Azure DevOps
      • For example:
        - task: SonarCloudPrepare@1
              SonarCloud: 'sonarcloud'
              organization: 'foo'
              scannerMode: 'MSBuild'
              projectKey: 'foo_sonar-scanning-someconsoleapp'
              projectName: 'sonar-scanning-someconsoleapp'
              extraProperties: |
  • The important logs are in the END step (i.e. SonarQubeAnalyze / SonarCloudAnalyze / ‚ÄúRun Code Analysis‚ÄĚ)

Share the msbuild detailed logs

MsBuild.exe /t:Rebuild /v:d


dotnet build -v:d


Hello Ann,
Thank you very much for your inputs.
The issue that i highlighted earlier, does not exists anymore.

However at the ‚Äúend‚ÄĚ step of SonarScanner, I am getting the below error:

Possible causes:

1. The project has not been built - the project must be built in between the begin and end steps
2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0.25420.1 and higher are supported.
3. The begin, build and end steps have not all been launched from the same folder
4. None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)

The point # 1,2,3 are perfectly satisfied. Not sure about the last one.

My sln and underlying csproj targets .Net framework 4.8

I attach herewith the debug logs of the same.

Would be thankful to you if you can assist me with the missing piece of information.

sonarlog.txt (228.4 KB)


Before the ‚ÄúPossible causes‚ÄĚ, the log says this:

12:02:10.272 The SonarScanner for MSBuild integration failed: SonarQube was unable to collect the required information about your projects.

Before we get to that point in the log, though, there are a lot of errors in your log. I think you need to sort those out first.


Hello Ann,
Thanks for the same. I am going through the same and once done will reach you again.


1 Like

Hello Ann,
The issue is sorted. I am able to see the code coverages now.
It was the issue with the sonar scanner that I was using.
I should have used SonarScanner.Msbuild, which was not the case and hence the issue.

Thank you for your help again. You can mark this ticket as Resolved.


1 Like