SonarQube is not picking the .cs file and not analyzing it

stage(‘SonarQube Analysis’) {
steps {
script {
env.SONAR_RUNNER_HOME = env.SONAR_SCANNER_HOME
}

            bat "\"${SONAR_SCANNER_HOME}\\bin\\sonar-scanner.bat\" -Dsonar.projectKey=${SONAR_PROJECT_KEY} -Dsonar.sources=. -Dsonar.language=cs -Dsonar.host.url=${SONAR_HOST_URL}"
        }

This is my pipeline script, but I am not sure why this is excluding the .cs file in my project folder.

SonarScanner for MSBuild version : sonar-scanner-msbuild-5.13.1.76110-net46\SonarScanner.MSBuild.exe

I have uninstalled c# analyzer in SonarQube UI and later I couldn’t able to find it to install the plugin.

Please help me for these cs is not getting analyzed and c# plugin is not able to install issues. Thank you

That sounds like something you shouldn’t be able to do since a long time. What version of SonarQube are you using?

Hi Colin,

I was using * Community Edition * Version 8.3 (build 34182)

Hi,

Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

8.3 → 8.9.10 → 9.9.1 → 10.1 (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.

I have upgraded till 9.9.1- community edition but still it is not picking the .cs files from the project folder. I have attached the console output logs for your reference.

sonarlogs.txt (2.9 KB)

Update here!!

I have added some a sonar-project.properties file and I was getting this attached logs.
sonarlogs_latest.txt (2.6 KB)
sonar-project.properties.txt (381 Bytes)

Hey there.

As mentioned in the logs:

WARN: Your project contains C# files which cannot be analyzed with the scanner you are using. To analyze C# or VB.NET, you must use the SonarScanner for .NET 5.x or higher, see SonarScanner for .NET

Hey Colin,

FYI, I was already configured sonar-scanner-msbuild-5.13.1.76110-net5.0 this version dll in Jenkins. But still it was throwing the same error and later it got fixed I think and in the same logs it was telling that no protobuf found contact the community team.

Let me suggest attaching your full Jenkins logs (the 20 lines you shared won’t be enough to figure out what’s going on) including the execution of the Scanner for .NET and your .NET build.

Please find the attached.

Jenkins-logs.txt (15.8 KB)



Hey there.

The logs you shared also show you executing the sonar-scanner and not the Scanner for .NET.

Have you reviewed the Analyzing other project types section of the documentation for the Jenkins extension? It includes an example for using the SonarScanner for .NET.

Hello,

I have now tried removing the SonarQube scanner from the Jenkins configs. But still same logs. I have attached the logs and the pipeline script as well for you reference.
Jenkins_logs.txt (15.8 KB)
pipeline {.txt (1.5 KB)

Again, I suggest following this example: