Analyser C# not Working

I use the sonarScanner for MsBuild With Build Pipeline in Azure Devops.
Log :
Task : Run Code Analysis
Description : Run scanner and upload the results to the SonarQube server.
Version : 4.11.0
Author : sonarsource

SonarQube version is

My Project is Build by the lastest Version of MsBuild, with Visual Studio 2019.

My project use a framework : .netStandard 2.1

The result sonarqube is empty, and in the log i have this warning :

17:04:08.247 INFO: Sensor C# Properties [csharp]
17:04:08.263 WARN: Analyzer working directory does not exist: ‘D:\agent_work\52.sonarqube\out\1\output-cs’. Analyzer results won’t be loaded from this directory.

17:04:08.263 DEBUG: Found Roslyn issues report

Help Me :slight_smile:

the log :slight_smile:

log.txt (166.1 KB)

No one to help me ???

Good Morning, @nmathieu! Could you please help me clarifying some points? What do you mean that the result is empty? Could you please navigate to project in sonarqube and check “Code” tab there? Could you see your C# files in there along with their lines of code or is this tab completely empty?

Here are sonarqube :

thx for your help

Hi Mathieu,

Are you sure that Scanner for MSBuild is the only scanner that you run in your pipeline?

1 Like


Hi @nmathieu

Which version of MSBuild are you using ? What does contain the task group ? is there any “standard” msbuild task on it ?


the task group

I use the last version of MsBuild, with Visual studio 2019 !

i try with a simple pipeline , same result

Do you see any kind of Sonar-related logs in this build solution task ?

Here is the log File of the build
log.txt (81.3 KB)

Hi @nmathieu

Sorry for the late reply.

I noticed some inconsistency between the auto-generated folder when building. For instance, on your last build log, it says “D:\agent_work\64\s” and on the run code analysis logs, analysis is made on “D:\agent_work\60\s”. Is that on purpose ? Can you check that on your full pipeline execution, everything goes in the same folder ?


Thx for your reply
Here is the Full Log of My Build Pipeline (602.4 KB)

Thanx :slight_smile:

Thanks for the logs. It looks like the Sonar Scanner for MSBuild targets are being executed during the build, but for some reason the SonarC# analyzer is not being executed. The SonarC# analyzer is responsible for calculating the lines of code per file as well as raising analysis issues, which is why no lines of code are being reported in SonarQube.

To help work out what is happening, could you try the following please?

  • temporarily remove your .editorconfig file and run the CI build to see if that makes a difference.

  • with the .editorconfig present, run a CI build with diagnostic logging enabled and send us the build logs (i.e. pass /v:diag as argument to MSBuild). That should give us a better idea of why csc.exe is not executing the SonarC# analyzer. If you could share your .editorconfig file that would also be useful.


1 Like

the file .editorconfig present in the solution?

Thx :slight_smile:

Yes; from the logs it looks like it is at the root of the source folder.

logs_7777 (1).zip (2.6 MB)

The log without the .editorconfig.

I upgrade sonarqube to version 8.5.
without the .editorconfig the warning is different:
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

After deleting I cannot find the .editorconfig file, who generates it?

The final message was changed in SQ 8.5. Since you use Scanner for MsBuild, this message is a side effect of the C# analyzer not being triggered during the csc build.

Do you have any *.targets files in your solution?

.editorconfig is usually added manually. VS can generate it when you do some configuration changes. You should check your backup to see the original file.