C# project not scanned: The main branch of this project is empty

Hi All,

we can’t analyze a C# project, we’ve tried several times following the guide we’ve found here:

https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-msbuild/

and using “Classic” .NET Framework Invocation, nevertheless we obtain the same result: The main branch of this project is empty.
SonarQube version is 9.4.0.54424
Scanner versioni is “SonarScanner for MSBuild 5.5.3”

May someone help us?
Best,
LC

Hi,

Could you share your full analysis log?

 
Ann

Hi,
in attachment you’ll find the logs.
Best,
LC
Problematiche CSharp.zip (11.8 KB)

Hi,

Thanks for sharing your logs. When I look at sonar_build.log I see a lot of references to .csproj files, but no(?) .cs files…?

By default, analysis recognizes files with a .cs extension as C# code files. If you’re using a non-standard extension, you’ll need to tell SonarQube what to look for. You can do that at the global or project level via the UI ([Global] Administration → Languages → C# → File suffixes, or Project Settings → General Settings → Languages → (&etc). You could also pass this as an analysis property, but IMO the UI is the better course here.

 
HTH,
Ann

Hi Ann,
the project contains files with a .cs extension. The .csproj file list them. Sonar see them as you can see in the attached image.
Please, let me know.
Best,
L.
Cattura.zip (18.6 KB)

Hi,

Given that your project has “Test” in the name, I suspect it’s being treated as a test project & thus no “Lines of Code” are detected (instead, they’re seen as lines of test code). This may help.

 
Ann