SonarQube Community - Simple Winform application in C# not scanned by SonarQube

Version: >> SonarQube Community
Objective >> Enable Sonar scan for a small C# project from Azure DevOps

Dear all,
I’m fignting with SonarQube to enable a scan of a small Windows form project developed in C# saved in Azure DevOps (using Git) and configured with a basic Pipeline.
The pipeline is working well and i can retrieve and run the EXE file from Artifact.
But in SonarQube project created for this one, there is no code line analysis (like an empty project):

In the files view of Sonar, i can see the list of C# files from my project, but no information from those file (like Lines of code):

I went in DevOps pipeline to look the log associated with SonraQube Code Analysis and found this line could explain why it was not managed:

2021-05-12T08:16:55.3556230Z INFO: Sensor C# [csharp]
2021-05-12T08:16:55.3556855Z WARN: No protobuf reports found. The C# files will not have highlighting and metrics. You can get help on the community forum:
2021-05-12T08:16:55.3557563Z INFO: Importing 1 Roslyn report
2021-05-12T08:16:55.3558050Z INFO: Found 1 MSBuild C# project: 1 MAIN project.
2021-05-12T08:16:55.3558934Z INFO: Sensor C# [csharp] (done) | time=31ms

But i have no idea why the “protobuf” report is not found, do you have any idea how i can try to fix it ?

PS: I can provide you the project source code easily if necessary.

Thanks by advance for your help.


Dear all,
After hours spent to find the reason of that issue.
I recreated a full fresh dotnet winform project with VS Code and configured all in DevOps to build and test with the same issue.
I finally found the reason of and solution to fix the case:
Analyser C# not Working

The solution was at the Build Task of Azure DevOps to ask it to run test with build via this option:

  • /p:RunAnalyzersDuringBuild=true

Now SonarQube detected the C# code and placed color coding with issue and code smells as visible here

I have also the Overview updated with Quality Gate status related to last run of scan

So now this case can be closed.

Thanks anyway and enjoy your day.

1 Like

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

Thank you @fromelard for coming back and informing us of your solution!

Do you know what version of Sonar scanner for MSBuild you are using? This error you ran into should be fixed in v5.2.0.

If you are using Sonar scanner for Azure DevOps (v4.20.0), then it uses Sonar scanner for MSBuild v5.2.1.