Search code examples
c#visual-studio-2013commentsstylecop

How to automate property/method headers when implementing an interface to satisfy StyleCop


We use StyleCop to enforce documentation of our code.

StyleCop (out of the box) requires properties and methods to be documented. Theoretically, interfaces and their concretions can have different headers but in practice they're usually identical.

However, when an interface is implemented in the concretion, the header isn't copied over meaning that it has to be done manually. Is there a better way to automate this rather than having to copy over each one?

Obviously we could simply copy the interface code en masse but you lose a lot of the stub code so it isn't really a perfect solution.


Solution

  • You can use Ghostdoc, an addin for Visual Studio. After installed it, just right click to the properties, classes or methods and click "Document This".

    If you have long properties or methods you can use Resharper to auto implement and copy the interface documentations.