.NET & C# projects code coverage is not showing


I did analysis on a c# project and .NET project in my local. In sonarqube server I can see unit test cases but code coverage is showing 0.0%. I see many documents but didn’t solve the problems. And I can see lot of questions on code coverage with C# and .NET projects but no one give proper guidance. Other than that directing to SonarQube documentation which doesn’t have proper steps.

Can you please give me in detail steps for .NET and C# projects SonarQube analysis which includes code coverage steps as well??

I know definitely people will share this url but no help with that url. The steps are not in-detail.

Definitely, SonarQube is a great tool for static code analysis but doesn’t have proper documentation.

Thanks for your help in advance.

Hi @venkat255,

  • Are you running the commands in the following order?

SonarScanner.MSBuild.exe begin /k:“project-key”
MSBuild.exe /t:Rebuild
SonarScanner.MSBuild.exe end

  • which version of the scanner for MSBuild are you using?
  • which coverage engine are you using?
  • is the coverage report being produced correctly? (i.e. does the coverage report file exist on disk)
  • which version of .NET are you targeting? (if it’s .NET Core check that you have specified DebugType is “Full” in your project file - see this issue for more information)