visual-studiostylecop

How to Disable the StyleCop add project and header info from Intellisense Visual Studio


I use StyleCop with Visual Studio 2022. For my Solutions, I use an .editorconfig file to manage all of my StyleCop analyzer rules. I also have the rule 1633 File should have header disabled as I do not use headers in my documents to minimize clutter. However, StyleCop still adds the options Add StyleCop settings file to the project and Add file header into the Intellisense context menu.

enter image description here

Is there a way to disable these two options from the Intellisense menu? I regularly accidentally click one of these causing those action to perform.


Solution

  • I eventually posted this as an issue on StyleCop's GitHub page.

    https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3679

    I received the answer there how to resolve this.

    The settings can't be properly controlled from the Visual Studio editorconfig editor. When set to disabled through Visual Studio's editor, it will set the value to silent, which does not eliminate the context menus.

    You must instead open the the .editorconfig file in another text editor (eg. notepad++) and manually change the line dotnet_diagnostic.SA1633.severity = none. This will stop the context menus from appearing.

    This has been opened as an issue on the Roslyn project https://github.com/dotnet/roslyn/issues/69176.