Excluded by org.sonarsource.dotnet.shared.plugins.GeneratedFileFilter


How can I disable the org.sonarsource.dotnet.shared.plugins.GeneratedFileFilter on SonarQube while we started the analyze the .cs file but excluded the .generated.cs files?

Please advise


We consider that generated code should not be analyzed, since the developer has no direct way to fix issues (apart to fix the code generator). And often generated code may look unmaintainable.

Can you share your use case? Why would you like to have generated code analyzed?


We only use the c# plugin for analyze the .cs files.

Here is the step by step for analyze
1-SonarScanner.MSBuild.exe begin /k:“xxx”
2-MSBuild.exe “X:\XYZ.sln” /t:Rebuild /p:Configuration=Release /p:Platform=“Any CPU”
3-SonarScanner.MSBuild.exe end

After display the analyze result on Sonarqube web UI but not display the .generated.cs files.

Here is the error mesage below as:
xxx.generated.cs’ excluded by org.sonarsource.dotnet.shared.plugins.GeneratedFileFilter

DEBUG: Skipping auto generated file:

Please advise how can I disable this filter.


You can’t. This is not an error. We assume generated files should not be analyzed or it will produce garbage results.

Thanks for information.



We released SonarC# 7.15 which now has an option to enable the analysis of generated code. It is available in Project > Administration > General Settings > C#.

Note that we still don’t advise the analysis of generated code as it often creates issues which can’t be fixed by developers. When this option is enabled developers are encouraged to list files they don’t want analyzed via the property: sonar.exclusions


Can this configuration also be performed via a command line parameter for “dotnet sonarscanner”?


Hi @DiegoDalben,

Apologies for the late reply. No, it is not possible to toggle analysis of generated code as a Sonar analysis parameter, but you can still do it at command line via shell/curl script like so:

curl -s -u login:password -X POST '$SONARQUBE_HOST/api/settings/set?key=sonar.cs.analyzeGeneratedCode&value=true

Not the same as passing an analysis parameter, but this gives you a way to do it via command line.