Code coverage is not updated on sonarqube server

Hello,

I am building and pushing static analysis report to sonarqube server for my ASP.NET application from developer command prompt for VS 2017, analysis result is pushing to the server but code coverage is not showing on sonarqube server.

Below is the sequence of commands i am trying-

  1. SonarScanner.MSBuild.exe begin /k:“Project-Key” /d:sonar.host.url=SonarQube server URL /d:sonar.login=“Token” /d:sonar.cs.opencover.reportsPaths=D:\coverage.xml
  2. MSBuild.exe /t:Rebuild
  3. “D:\packages\OpenCover.4.7.1221\tools\OpenCover.Console.exe” -output:“D:\coverage.xml” -excludebyattribute:.ExcludeFromCodeCoverage -filter:“+[] -[.js] -[.html]” -register:user -target:“C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Ms\TestWindow\vstest.console.exe” -targetargs:“D:\bin\Debug\Web.Test.dll”
  4. SonarScanner.MSBuild.exe end /d:sonar.login=“Token”

Sonar Scanner Version- SonarScanner.MSBuild (4.10.0.19059)

I am not sure why test case coverage is not uploading to the sonarqube server.

Thank you very much in advance!!!

Hey there.

  • What version of SonarQube. are you using? You should find this in the footer of your instance.
  • You’re using a very old version of the SonarScanner for MSBuild (now called the SonarScanner for .NET). Can you try using the latest version?

If you’re still stuck, you can find the logs about importing code coverage by checking the guide below:

Hello,

Thank you very much for your help!!

We are using SonarQube Community Edition Version 7.9.2 (build 30863) also I have update the SonarScanner for MsBuild to version 5.15.1.88158-net46. But still it is not uploading code coverage to SonarQube server. All the test cases are passed in VS developer command prompt during build process using OpenCover.4.7.1221 and coverage.xml is also genrated on analysis machine.

I am not sure what us the exact issue for not uploading the test coverage report to SonarQube.

Hi,

Your version is past EOL. You should upgrade to either the latest version or the current LTA (long-term active version) at your earliest convenience. Your upgrade path is:

7.9.2 → 8.9.10 → 9.9.6 → 10.6 (last step optional)

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

If your issue persists after upgrade, please come back to us. At that point, you’ll also find all the documentation on .NET Test Coverage is relevant for your version of SonarQube.