title: FxCop behavior in VS2010, Code Analysis, and SuppressMessage
body: <p>I have a class like this one:</p>
  
  <pre><code>    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Io")]
      public void ParaQueFalleCalidadCodigoUnoIo_ReglaCA1709()
      {
  
      }
  
      public void ParaQueFalleCalidadCodigoDosIo_ReglaCA1709()
      {
  
      }
  </code></pre>
  
  <p>I use a custom Ruleset file <strong>CustomRules.ruleset</strong></p>
  
  <pre><code>&lt;RuleSet Name="RulesNet" ToolsVersion="10.0"&gt;
    &lt;RuleHintPaths&gt;
      &lt;Path&gt;C:\Fxcop10.0\Rules&lt;/Path&gt;
    &lt;/RuleHintPaths&gt;
    &lt;Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed"&gt;
  
      &lt;Rule Id="CA1709" Action="Warning" /&gt;
  
    &lt;/Rules&gt;
  &lt;/RuleSet&gt;
  </code></pre>
  
  <p>When I run VS2010 built in Code Analysis tool, I get this warning:</p>
  
  <blockquote>
    <p>CA1709 : Microsoft.Naming : Correct the casing of 'Io' in member name
    '_Default.ParaQueFalleCalidadCodigoDosIo_ReglaCA1709()' by changing it
    to 'IO'.</p>
  </blockquote>
  
  <p>Now, I can use this same rule set file <strong>CustomRules.ruleset</strong> in <em>FxCopCmd.exe</em>:</p>
  
  <blockquote>
    <p>FxCopCmd.exe /gac /d:"C:\CompanyFramework\4.0.0.0" /f:"D:\TFS\Tests\WebApplication1\bin\WebApplication1.dll" /o:"resultsFxCop.xml" /ruleset:"=CustomRules.ruleset" /v </p>
  </blockquote>
  
  <p>I get <strong>2 errors</strong> (FixCategory Breaking, and Level Error)</p>
  
  <blockquote>
    <p>CA1709 - Correct the casing of 'Io' in member name
    '_Default.ParaQueFalleCalidadCodigoUnoIo_ReglaCA1709()' by changing it
    to 'IO'.</p>
    
    <p>CA1709 - Correct the casing of 'Io' in member name
    '_Default.ParaQueFalleCalidadCodigoDosIo_ReglaCA1709()' by changing it
    to 'IO'.</p>
  </blockquote>
  
  <pre><code>  &lt;Message Id="Io" TypeName="IdentifiersShouldBeCasedCorrectly" Category="Microsoft.Naming" CheckId="CA1709" Status="Active" Created="2013-02-05 10:24:01Z" FixCategory="Breaking"&gt;
               &lt;Issue Name="Member" Certainty="85" Level="Error" Path="D:\TFS\Tests\WebApplication1" File="Default.aspx.cs" Line="21"&gt;Correct the casing of 'Io' in member name '_Default.ParaQueFalleCalidadCodigoUnoIo_ReglaCA1709()' by changing it to 'IO'.&lt;/Issue&gt;
    &lt;/Message&gt;
  
    &lt;Message Id="Io" TypeName="IdentifiersShouldBeCasedCorrectly" Category="Microsoft.Naming" CheckId="CA1709" Status="Active" Created="2013-02-05 10:24:01Z" FixCategory="Breaking"&gt;
               &lt;Issue Name="Member" Certainty="85" Level="Error" Path="D:\TFS\Tests\WebApplication1" File="Default.aspx.cs" Line="26"&gt;Correct the casing of 'Io' in member name '_Default.ParaQueFalleCalidadCodigoDosIo_ReglaCA1709()' by changing it to 'IO'.&lt;/Issue&gt;
    &lt;/Message&gt;
  </code></pre>
  
  <p>In resultsFxcop.xml, I have seen CA1709: IdentifiersShouldBeCasedCorrectly rule:</p>
  
  <pre><code> &lt;Rule TypeName="IdentifiersShouldBeCasedCorrectly" Category="Microsoft.Naming" CheckId="CA1709"&gt;
     &lt;Name&gt;Identifiers should be cased correctly&lt;/Name&gt;
     &lt;Description&gt;Type, namespace, and... OMITED.&lt;/Description&gt;
     &lt;Resolution Name="Member"&gt;Correct the casing of '{0}' in member name {1} by changing it to '{2}'.&lt;/Resolution&gt;
     &lt;Owner /&gt;
     &lt;Url&gt;http://msdn.microsoft.com/library/ms182240(VS.100).aspx&lt;/Url&gt;
     &lt;Email&gt;[none]&lt;/Email&gt;
     &lt;MessageLevel Certainty="85"&gt;Error&lt;/MessageLevel&gt;
     &lt;File Name="namingrules.dll" Version="10.0.0.0" /&gt;
    &lt;/Rule&gt;
  </code></pre>
  
  <p>MessageLevel for CA1709 rule:</p>
  
  <blockquote>
  <pre><code>   &lt;MessageLevel Certainty="85"&gt;Error&lt;/MessageLevel&gt;
  </code></pre>
  </blockquote>
  
  <p>Two issues: </p>
  
  <ul>
  <li>I get Errors but CA1709 rule Action is Warning</li>
  <li>SuppressMessage is ignored using FxCopcmd.exe</li>
  </ul>
  
  <p>Now, I modify <strong>CustomRules.ruleset</strong> and I execute FxCopcmd.exe again</p>
  
  <pre><code>&lt;Rule Id="CA1709" Action="None" /&gt;
  </code></pre>
  
  <p>I get <strong>NO errors</strong>.</p>
  
  <p>I modify <strong>CustomRules.ruleset</strong> and I execute FxCopcmd.exe again</p>
  
  <pre><code>&lt;Rule Id="CA1709" Action="Ignore" /&gt;
  </code></pre>
  
  <p>I get the same <strong>2 errors</strong>.</p>
  
  <p>I need use FxCopCmd.exe and a custom ruleset.</p>
  
  <ul>
  <li>Does SuppressMessage works for FxCopcmd.exe? </li>
  <li>Why do I get errors if Action is Warning, using Fxcopcmd.exe?</li>
  <li>What does MessageLevel Error for CA1709 rule mean? More priority than Rule Action "Warning"?</li>
  </ul>
  
  <p>Any suggestions?</p>
  
  <p><strong>Update</strong></p>
  
  <p><a href="http://social.msdn.microsoft.com/Forums/en/vstscode/thread/3f8931da-9a4d-47a6-b331-8b6b07aea8d6" rel="nofollow">http://social.msdn.microsoft.com/Forums/en/vstscode/thread/3f8931da-9a4d-47a6-b331-8b6b07aea8d6</a></p>
  
  <p><a href="http://social.msdn.microsoft.com/forums/en-US/vstscode/thread/3cb6c50c-7095-4551-a4e3-a3cbc7cb85be" rel="nofollow">http://social.msdn.microsoft.com/forums/en-US/vstscode/thread/3cb6c50c-7095-4551-a4e3-a3cbc7cb85be</a></p>
  
  <p>For the default FxCop rules, there is no easy way to modify the message level,</p>
  
  <p><em>MessageLevel</em> is the importance of the message, e.g. if you had thousands of messages, it probably would be a good idea to start addressing the Critical (the exclamation mark) Errors first.</p>
  
  <p><em>Certainty</em> is the number the Rule writer assigns to each rule, it is the likelihood that a message leads to a code change. This number is built up based on feedback from domain experts &amp; customers and how well the heuristic used in the rule is able to avoid false positives.</p>
  
  <p><em>Fix Category</em>: This indicates if the fix for a violation would be a binary breaking change if the code has previously shipped. e.g you have a library with a misspelling in it that you have already shipped to customers. You now start running FxCop on it and see the misspelling. FxCop will tell you this is a breaking change. If you fix the misspelling and ship a new version of your library to customers, they can't use the library without changing and recompiling their code. So you probably want to ignore the FxCop violation on this API. On the other hand, if you never shipped, it would be totally fine to fix the FxCop violation.</p>