Your project contains C# files which cannot be analyzed

we have moved over from a dedicated sonarqube instance to sonarcloud. when we are running the analyzer on our c# projects they aren’t analyzing the files correctly anymore.

  • GitHub and Jenkins

dotnet sonarscanner begin /o:org /k:org_repo / /d:sonar.login=login /d:sonar.cs.opencover.reportsPaths=**coverage.opencover.xml' /v:version /

  • dotnet core 3.1, c#
  • 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 Scanner for MSBuild 4.x, see

running dotnet sonarscanner prints out
SonarScanner for MSBuild 4.10 Using the .NET Core version of the Scanner for MSBuild

trying to install sonarscanner
dotnet tool install --global dotnet-sonarscanner
Tool 'dotnet-sonarscanner' is already installed.

Hi @mlapaglia,

There should be one or two WARN messages above the warning you’ve mentioned that should help to diagnose the scenario. Can you please share those? Something about protobuf and/or Roslyn issue report.

@Pavel_Mikula, I am getting the same error, the two lines above:

[13:11:36] [Step 3/8] 13:11:38.714 WARN: No protobuf reports found. The C# files will not have highlighting and metrics.
[13:11:36] [Step 3/8] 13:11:38.714 WARN: No Roslyn issue reports were found. The C# files have not been analyzed.

I have it running a JRE version from here:

Running in TeamCity using the TC Plugin. I must add I am using 2017, not 2020 version of the plugin, but I think it should still do some reporting? It seems to find some cs files, not all but some though in the logs.

Hi @cwatts90,

Welcome to our community! Your case seems to be different, because you’re using different scanner (if your link is correct).

In your case, you’ll need to use SonarScanner for MSBuild in order to analyze C# code.

Just to clarify something, that might be confusing:

  • dotnet sonarscanner is one of variants of sonar scanner for MSBuild, as originally reported in this thread.
  • Generic sonarscanner from SonarScanner page is something different, it’s not a MSBuild specific scanner.

Hope this helps.

Apologies, it seemed to be the same given the same error message! I dont think I can use the SonarScanner for MSBuild as I am using TeamCity and it doesnt come with the JAR for uploading into TC…? Not 100%, there appear to be a lot of disparate sources at the moment, not a single point of reference. I think the MSBuild scanner is for running locally?

Both MSBuild version and non use the same sonar-scanner-cli-4.x.jar, so, given I can only upload a jar to the tools bit in TeamCity, I was stuck… is there a way to install the scanner into the server?

Hi Chris,

I don’t know how TeamCity works, I could only find this thread related to it: Steps to integrate SonarQube with TeamCity builds

It seems that there’s a 3rd party way of doing it, but we don’t maintain it so we can’t help with issues that might occur when using it.

In general, Scanner for MSBuild isn’t a JAR package. It’s executable that

  • Begin step: Uses scanner CLI to prepare the analysis
  • Begin step: Does some .NET specific steps to plug our analyzers in the .NET build
  • The build is triggered
  • End step: Collects analysis results (protobuf reports, Roslyn issue reports) from previous steps
  • End step: Submits the results using scanner CLI