Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


To activate this mode, add the following lines to your project analysis configuration file:

Code Block


Set the sonar.fxcop.assemblyDependencyDirectories property to a comma-separated list of paths patterns to locate the directories containing the dependency assemblies. Paths are relative to the folder folders containing the ".csproj" files.

How to not report issues on generated code?


Set the sonar.stylecop.analyzers.settings property to the file that holds additional settings for StyleCop. The path is relative to the folder folders containing the ".csproj file" files.

This settings files will not be used to specify the active rules. Only settings such as "expected header contents", company names and so on will be used during the analysis.


This rule works at class level. If you are working on a Windows form or NET project, you may have many partial classes. The code generated in the "designer" parts may contain many "visible fields" whereas the real code that matters does not contain any defects. In order to avoid these false positives, you have two options:

  1. Disable this rule. Probably not the best option.
  2. Use the Switch Off  Violations plugin to disable the rule only on "view" related components.

On an NET project you may configure the Switch Off violations plugin as follow: