title: How do you resolve the discrepancy between "StyleCop C# style" and "Framework Design Guidelines C# style"?
body: <p>After going through the Appendix A, "C# Coding Style Conventions" of the great book "Framework Design Guidelines" (2nd edition from November 2008), I am quite confused as to what coding style is Microsoft using internally / recommending.</p>
  
  <p>The blog entry <a href="http://blogs.msdn.com/sourceanalysis/archive/2008/05/25/a-difference-of-style.aspx" rel="noreferrer">A Brief History Of C# Style</a> claims:</p>
  
  <blockquote>
    <p>In fact, the differences between the "StyleCop style" and the "Framework Design Guidelines style" are relatively minor</p>
  </blockquote>
  
  <p>As I see it, the differences are quite pronounced. StyleCop says opening brace should be on a separate line, Framework Design Guidelines say it should be after the opening statement. StyleCop says all keywords are to be followed by a space, Framework Design Guidelines say 'get rid of all spaces' (even around binary operators).</p>
  
  <p>I find this rule from the Framework Design Guidelines book especially ironic (page 366, 6th rule from the top):</p>
  
  <blockquote>
    <p><b>Do not</b> use spaces before flow control statements</p>
  
  <pre><code>Right: while(x==y)
  Wrong: while (x == y)
  </code></pre>
  </blockquote>
  
  <p>This is explicitely stating that the StyleCop style is <strong>wrong</strong> (space after the while keyword, spaces before and after the equality binary operator).</p>
  
  <p>In the end, code formatted using the StyleCop style has quite a different "feel" from the one formatted using the Framework Design Guidelines style. By following the Framework Design Guidelines style, one would have to disable a bunch of the rules (AND there are no rules that check adherence to the Framework Design Guidelines style...).</p>
  
  <p>Could somebody (MSFT insiders perhaps?) shed some light on this divergence?</p>
  
  <p>How is your team dealing with this? Following StyleCop? Framework Design Guidelines? Ignoring style altogether? Baking your own style?</p>