No protobuf reports found. C# files were not analyzed

Hi all!
Must-share information :

  • which versions are you using SonarQube : Community Edition - Version 9.9 (build 65466)
  • how is SonarQube deployed: zip
  • what are you trying to achieve: I am trying to analyze my project with sonarqube but I am experiencing problems with c# files.
  • What have you tried so far to achieve this result?
    Sonarqube is installed on a remote machine and via gitlab jobs we launch sonarqube.
    The commands used are as follows:
    SonarScanner.MSBuild.exe begin /k: “key” /d:sonar.login=“token”
    MSBuild.exe /t:Rebuild
    SonarScanner.MSBuild.exe end /d:sonar.login=“token”

Some useful info about the project:
The project is a web application that was built in .net Core 1.0 (if I remember correctly) with the project files being in an ‘.xproj’ version and the dlls being in .net framework 4.6.1 instead.
Moving from visual studio 2015 to 2019 (and now to 2022) since the .xproj files were no longer supported they were migrated to .csproj.
Now all elements in the solution have 4.6.1 as the target framework.
(I think because of this there is another problem and the files that were .net Core are not parsed with msbuild and we need the dotnet command)

Now we come to the main problem, after launching the Job the project is created on sonarqube but the c# files are not parsed (only the .xml ones). Going to the sonarqube page the c# classes are present but not parsed.

Looking at the scan result I find this information:

INFO: Sensor C# [csharp].
WARN: No protobuf reports found. The C# files will not have highlighting and metrics. You can get help on the community forum: https://community.sonarsource.com

I attach logs:
SonarResult.zip (332.6 KB)

Thank you very much!

Hi,

Welcome to the community!

Thanks for the log. I’m seeing a lot of this:

CSC : warning CS8032: An instance of analyzer SonarAnalyzer.Rules.CSharp.[rule name] cannot be created from C:\Windows\TEMP\.sonarqube\resources\0\SonarAnalyzer.CSharp.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.. [C:\GitLab-Runners\ECMS\builds\xRixTdXz\0\italy\solution-services\technology-solutions\project\ecms\ECMS.Models\ECMS.Models.csproj]

Based on the SO answers searching sends me to, it looks like some of your NuGet packages might be out of date…?

 
Ann

Hi @Emmear

From your logs:

Microsoft (R) Build Engine version 14.0.23107.0

This is a very old MSBuild version.

You probably don’t use the MSBuild version coming with VS 2019 or VS 2022. I suggest to verify this.

We’ve seen this in the past:

Other answers that might help:

1 Like

Thank you all for the responses, I will try your suggestions and give feedback.