title: Warnings as Errors - does not apply to Stylecop warnings
body: <p>I want to treat Stylecop warnings as errors, but it's not working for me.</p>
  
  <p>My projects are configured to treat warnings as errors, and if I build with a real "compiler warning" it does indeed display a <em>compiler error</em>. But with a "Stylecop warning" it only displays a <em>compiler warning</em>.</p>
  
  <p>As a result of this, my checkin to TeamCity annoyingly does not break the CI build when there are Stylecop warnings.</p>
  
  <p>I am using VS2013 with Stylecop 4.7.49.</p>
  
  <h2>My settings:</h2>
  
  <ul>
  <li><p><strong>Project -> Properties -> Build</strong></p>
  
  <ul>
  <li>Warning level: 4</li>
  <li>Suppress warnings: 1591</li>
  <li>Treat warnings as errors: All</li>
  </ul></li>
  <li><p><strong>Project -> Stylecop Settings -> Options</strong></p>
  
  <ul>
  <li>Treat violations as errors: Checked</li>
  </ul></li>
  </ul>
  
  <h2>Example code that breaks the build correctly, containing real compiler warning:</h2>
  
  <pre><code>using System;
  
  namespace CodeUsageTest
  {
      public class CodeUsage
      {
          private string fff()
          {
              int nobodyLovesMe; //CS0168
              return "";
          }
      }
  }
  </code></pre>
  
  <p>Build output:</p>
  
  <pre><code>1&gt;------ Build started: Project: CodeUsageTest, Configuration: Debug Any CPU ------
  1&gt;D:\Sandbox\CodeUsageTest\CodeUsage.cs(9,17,9,30): error CS0168: Warning as Error: The variable 'nobodyLovesMe' is declared but never used
  ========== Build: 0 succeeded, 1 failed, 3 up-to-date, 0 skipped ==========
  </code></pre>
  
  <h2>Example code that doesn't break the build (although I want it to), containing stylecop warning:</h2>
  
  <pre><code>using System;
  
  namespace CodeUsageTest
  {
      public class CodeUsage
      {
          private string fff() //SA1300
          {
              return ""; //SA1122
          }
      }
  }
  </code></pre>
  
  <p>Build output:</p>
  
  <pre><code>1&gt;------ Build started: Project: CodeUsageTest, Configuration: Debug Any CPU ------
  1&gt;D:\Sandbox\CodeUsageTest\CodeUsage.cs(7,1): warning : SA1300 : CSharp.Naming : method names begin with an upper-case letter: fff.
  1&gt;D:\Sandbox\CodeUsageTest\CodeUsage.cs(9,1): warning : SA1122 : CSharp.Readability : Use string.Empty rather than "".
  ========== Build: 1 succeeded, 0 failed, 3 up-to-date, 0 skipped ==========
  </code></pre>