Reputation: 190889
I got tens of CA1703:Microsoft.Naming error
resource Resources.resx', referenced by name 'code', correct the spelling of
'addfile' in string value '#set ...'
It's ridiculous, as StyleCop's running spelling check on the code to make spelling error.
How can I suppress this StyleCop error?
I tried to use the SuppressMessage from this hint, but I got error again - Error 70 The type or namespace name 'SuppressMessageAttribute' could not be found (are you missing a using directive or an assembly reference?)
[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "CA1703:Microsoft.Naming", Justification = "This is tcl script, spelling check is meaningless")]
public static void Generate(string clientDirectory, string topLevelTestbench, string doFileName)
Upvotes: 1
Views: 1818
Reputation: 6373
As Nicole Calinoiu said it's a FxCop rule. Here's the rule description http://msdn.microsoft.com/en-us/library/bb264483.aspx You can easily add words to your own dictionary to avoid having errors for words FxCop doesn't know (like the name of your company or some tech words), see http://msdn.microsoft.com/en-us/library/bb264492.aspx
Upvotes: 0
Reputation: 20992
CA1703 is an FxCop rule, not a StyleCop rule. Since you seem to be unaware that you are using FxCop, I'm guessing that you are using the Code Analysis version that is integrated with certain Visual Studio editions. If so, you can simply right-click the issue(s) in the Visual Studio error list, then select the Suppress Message(s)
-> In Project Suppression File
context menu item to automatically add SuppressMessage
attribute(s) that are correctly populated for the issue(s) in your resource files. (Simply adding the System.Diagnostics.CodeAnalysis using directive will not be enough since neither the category nor the check ID in your sample attribute instance is correct for the CA1703 rule.)
Upvotes: 3
Reputation: 38407
Are you using the correct using directive:
using System.Diagnostics.CodeAnalysis;
To make sure it can find the SuppressMessage class?
Upvotes: 3