StyleCop Project Settings

While it is possible to have developers agree on many things, a discussion on coding style is likely to produce seriously contentious debate.

Visual Studio provides static code analysis capabilities to ensure that the IL, contained within assemblies, follows certain design patterns. Given that static code analysis examines IL and not the C# or VB code from which the IL results, how do we ensure that code is consistent and follows an agreed coding style?

StyleCop, unlike static code analysis, examines the C# source code and ensures that the source code follows a set of guidelines or coding style. While you may not agree with all of the rules that StyleCop enforces, it does allow us, at least for the most part, to put aside the contentious debate among developers and to then create a consistent codebase among a team of developers.

What might not be obvious to developers using StyleCop today is how to customize the rules that StyleCop enforces when examining code.

If you open the Windows Explorer, then navigate to the StyleCop installation folder:

C:\Program Files (x86)\Microsoft StyleCop 4.4.0.12\

You will find the settings file for StyleCop on that computer. Open the Settings.StyleCop file and the settings editor will enable you to customize the StyleCop experience.

StyleCop Project Settings 1 

StyleCop: https://stylecop.codeplex.com/

StyleCop compliant C# code snippets, CodePlex.Snippets: https://cpsnippets.codeplex.com/