How to enable code coverage in sonarcloud.io for c# project

I have integrate SonarCloud to my open source project, but not getting code coverage report as it Quality Profiles is not pointing to c#.

Could anyone help me how to enable code coverage for .net core C# project?

Sonar report (without code coverage) is as below https://sonarcloud.io/dashboard?id=Amitpnk_Hexagonal-Architecture-ASP.NET-Core

Hi @Amit_Naik and welcome to the community .

We would need a bit more context here.

Which CI tool are you using ?
Are you specifying by hand some of the coverage / test execution property while running your build / analysis ?

Thanks in advance.

hi @mickaelcaro,

thank you for your reply,

I am using SonarCloud Automatic Analysis and also tried with CircleCI, but Quality profile is set to html and xml, instead of c#

Below is my github project

Hi @Amit_Naik

SonarCloud automatic analysis doesn’t support C# code for now. You’ll need to rely on something else.

Circle CI should be good, but you have to ensure that you use the SonarScanner for .NET in order to get your C# code analysed.

HTH
Mickaël

Thank you so much @mickaelcaro,

Do you have any documentation for SonarScanner integration to dotnet core project? it would be of great help

Regards,
Amit Naik

You can read our document on the Scanner itself, which can be found here. This is available in multiple “format” (dotnet core global tool, …) which may interest you.

HTH,
Mickaël

Thank you so much @mickaelcaro for your help.

I am able to enable code coverage for my project

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.