Sonar are not Analyzing C# Code

Server SonarQube:

  • Linux: Ubuntu 20.04
  • Developer Edition Version 8.9 (build 43852)

Source Code

  • Dotnet Core 3.2 e 5.0
  • Files extension *.cs

CI/CD Environment

  • Jenkins with Pipeline
  • dotnet-sonarscanner 5.3.1 – sonar-scanner-

Parameter used

NOTE: I change some values because of privacy and security.

dotnet-sonarscanner begin /k:"PB" /d:sonar.login="$TOKEN" \
/n:"Project BackEnd" \
/d:sonar.verbose="false" \
/"" \
/d:sonar.exclusions="ClientApp/**" \
dotnet build Project.sln
dotnet-sonarscanner end /d:sonar.login="$TOKEN"


INFO: Analysis report uploaded in 745ms
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at
INFO: Analysis total time: 7.793 s
INFO: ------------------------------------------------------------------------
INFO: ------------------------------------------------------------------------
INFO: Total time: 22.774s
INFO: Final Memory: 10M/485M
INFO: ------------------------------------------------------------------------
The SonarScanner CLI has finished



  • First, don’t check the lines of other folders, in other words, not doing the analysis.

    NOTE: Inside these folders, I have a lot of files *.cs.

  • Second, I try to exclude ClientApp but continue to load.

  • Third, I am receiving these two warnings.


I don’t know what’s happening, why the sonar is not getting those files, and analyzing the files inside the folders.

Hello @jaderoliver

You have a warning that there is only TEST-code for C#, please take a look at the following document describing the project categorisation process, and check why there is not MAIN-code detected.

There is a warning reported regarding the file encoding. First of all take a look at Program.cs and Startup.cs. These files are detected, but being reported to not contain any lines of code. This leads me to the assumption that the file encoding is wrong here. Maybe the files are encoded in ANSI and not UTF-8. Please check that with Notepad++ e.g.

Hello @jaderoliver

Did you manage to solve the problem you had?