33

Does anyone know how to change the StyleCop rule SA1600 that says elements must be documented so that it only applies to properties and not to private members?

Our ORM (DevExpress XPO) requires that you have private members for all public properties (because you have to call a function in the setter to persist it as well as storing it in the private member), and commenting both the public property and the private member with the same thing is killing me considering that some of the tables have upwards of 50 fields.

J0e3gan
  • 8,740
  • 10
  • 53
  • 80
Steven Evers
  • 16,649
  • 19
  • 79
  • 126

1 Answers1

48

Right click on your project node in Visual Studio, select StyleCop Settings. On the Rules tab, select the Documentation Rules node. In the right-hand pane, select the Ignore privates checkbox, and\or unselect the Include fields box. Either of these will achieve the desired effect.

  • 2
    Be sure of course to do this to the appropriate `Settings.StyleCop` file (i.e. StyleCop settings at the appropriate level). This may be the given project's; but if you are using a `Settings.StyleCop` file in a parent folder or one in a specific location you may want to click the Settings Files tab, then Edit... next to "Merge with settings file found in parent folders" or "Merge with the following settings file" in the StyleCop settings dialog before visiting the Rules tab. – J0e3gan Apr 23 '13 at 05:47
  • 1
    With StyleCop installed as NuGet package on VS2017 there is no StyleCop Settings menu item when I right-click on a project. Can I change 1600 settings manually in a file? How? – vkelman Mar 31 '20 at 15:59
  • I have the same problem as @vkelman. Is there any way of achieving this through the XML? – Javier Bullrich Jan 18 '21 at 16:28
  • @JavierBullrich - did you find a solution? – vkelman Jul 02 '21 at 16:26
  • @vkelman No, I did not. I ended up disabling the rule – Javier Bullrich Jul 05 '21 at 08:17