C# files not getting analyzed

Hi,
We are trying to integrate Jenkins with SonarQube. We are analyzing a .NET application which has C# and Javascript files. Invoking sonar scanner from the Jenkins pipeline script. Only javascript files are getting reported in SonarQube Dashboard but not the C# files.

SonarQube Version : 6.7.5
SonarScanner Version : SonarScanner for Msbuild 4.7.1.2311 - .NET Fwk 4.6
Jenkins Version : 2.164.3
Msbuild Path: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin
MsBuild Version: 16.2.37902.0

Below are the warnings during execution

Analyzer working directory does not exist: 'C:\home\jenkins\OXP-NightlyBuild\.sonarqube\out\2\output-cs'. Analyzer results won't be loaded from this directory

Commands:

bat "${sqScannerMsBuildHome}\\SonarScanner.MSBuild.exe begin /k:OXP /n:OXP /v:2.0 /d:sonar.host.url=%SONAR_HOST_URL% /d:sonar.cs.dotcover.reportsPaths=${WORKSPACE}/artifacts/dotCover.html /d:sonar.cs.nunit.reportsPaths=${WORKSPACE}/artifacts/TestResults.xml /d:sonar.login=%SONAR_AUTH_TOKEN% /d:sonar.exclusions=Static/**/*,**/Concrete.cs,**/Interface.cs,Content/Csc/**/*,**/vendor/**/*,**/jquery*.js,**/*.xml,**/jquery*.js,**/vendor/**/*.js,**/dist/** /d:sonar.sourceEncoding=UTF-8 /d:sonar.verbose=true"

bat "\"${msBuildHome}\"\\MSBuild.exe *****.sln /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OctoPackEnforceAddingFiles=true /p:DisableAnalyzers=True /p:RunOctoPack=true /p:OctoPackPackageVersion=${build_version}.%BUILD_NUMBER% /p:OctoPackPublishPackageToFileShare=${artifacts_path}"

bat "${sqScannerMsBuildHome}\\SonarScanner.MSBuild.exe end /d:sonar.login=%SONAR_AUTH_TOKEN%"

Please help regarding this issue.

Thanks in advance.

Regards,
Antony Alfred.

Hi @alfredantony012. Welcome to the community.

Are you running a separate build/analysis for the projects that contain the JavaScript files?

Have a look at the console output for the end step. The verbose output will contain the contents of the generated sonar-project.properties file. Does it list the .cs files you expect to be analysed?
Also, it would be useful if you can share the log for the end step, by private message if you prefer.

Hi,

I could see .cs files are listed in the console. How could i share the log file in private?

Thanks,
Antony Alfred.

Hi @alfredantony012,

To send a private message, click on a user name or image and select “Message”.