VB and C# files not being analyzed

I’m just starting with SonarCloud. I have successful scans running, but all VB and C# files are not being analyzed. In the log, I see:

INFO: 3710 files to be analyzed

WARN: This repository references another local repository which is not supported. You can avoid borrow objects from another local repository by not using --reference or --shared when cloning it.

INFO: 0/3710 files analyzed
Any advice on how to resolve that?

  • ALM used: BitBucket Cloud
  • CI system used: TeamCity
  • Languages of the repository: VB, C#, SQL, JS
1 Like

How do you know they are not being analyzed? On your project’s page on SonarCloud, can you browse on the Code tab to the VB and C# files?

How do you run the scanner?

Are the paths of the VB and C# code included in the sonar.sources setting?

Are you sure the paths of the VB and C# code are not explicitly excluded?

The warning about the clone with references is an unrelated issue, it does not cause files to be excluded from the analysis. However, it’s recommend to fix that issue, by following the message and not using --reference or --shared when creating the clone.

Hi Janos,

In SonarCloud, my projects that contain VB/C# contain no metrics or analysis. They aren’t included in the lines of code, either.

We are running the scanner through TeamCity with the following command:

sonar-scanner.bat -D"sonar.projectKey={key}" -D"sonar.organization={org}" -D"sonar.sources=." -D"sonar.host.url=https://sonarcloud.io" -D"sonar.login={login}" -D"sonar.c.file.suffixes=-" -D"sonar.cpp.file.suffixes=-" -D"sonar.objc.file.suffixes=-" -D"sonar.verbose=true"

Yes, the folders that contain the VB/C# files are included in the sources. The files appear in SonarCloud, but without any analysis, and are not included in overall metrics.

Yes, the folders that contain this code are not excluded.

Thanks for the help!

Hi @ml550, to analyze C# and VB .NET projects , you need to use the Sonar Scanner for MSBuild

You can read my answer here
And also C# Code Coverage with Team City integration might help

1 Like

Got it, thanks @Andrei_Epure! I’ll set that up.

Is it possible to run both Sonar Scanner for MSBuild and the standard scanner? My project has files types outside of VB/C# that I want to analyze, like SQL and JS.

yes, but you’ll need to setup two different projects in SonarQube - one for the dotnet analysis, and the other for the SQL and JS analysis