Disable Automatic File Header Creation (ReSharper and StyleCop)

4.6k Views Asked by At

I recently installed R# 6.1 (C# version, not Full) with StyleCop 4.7.34.0 (with the R# plugin). When adding a new class to a project, the file header information is automatically added. How do you disable this?

I've turned off the checkbox for "Insert text into documentation and file headers" within the R# options for StyleCop (Options > Tools > StyleCop > Headers section).... but still no luck.

I've also turned off StyleCop rules SA1633 to SA1640 that requires the header documentation.

I found this related post that suggests:

ReSharper -> Options -> Tools section -> Code Cleanup -> select StyleCop profile -> Documentation section -> untick 1600

but I don't have a "Code Cleanup" node in my tools section. Not sure if the fact that I'm using a "C#" version of R# has something to do with it.

2

There are 2 best solutions below

3
arserbin3 On

The problem is actually because of this: http://stylecop.codeplex.com/discussions/348351/

When you try to uncheck the StyleCop settings under Code Cleanup (Options > Code Editing > Code Cleanup > StyleCop > 1600 and 1633-1641) and click Save it does not actually save the changes! This seems to be a bug in ReSharper.

The only workaround i've found is to make a new profile (Add) and immediately uncheck 1600 then click Save. This will have to be set as the Profile to use on silent cleanup. Good luck


EDIT: here are the settings for my profile that is set as the 'silent cleanup' one. It does not add the headers. hope that helps ReSharper Code Cleanup Profile

0
Rob Powell On

I had this problem and found that the issue was not ReSharpers global StyleCop settings (arserbin3s answer); but the project specific ones.

Right click on your existing project and select "StyleCop Settings". First step

From there deselect "Documentation Rules" (or the specific rules you desire). Second step

Finally, I had to close and open Visual Studio. This prevented Resharper refactors from writing the headers and documentation.

You may have different context menu options to me. Either way, the key is that StyleCop can be project specific.

stylecop.codeplex.com/wikipage?title=Managing%20StyleCop%20Project%20Settings