FxCop accepts a question with my use of format strings in resources using NON-Team System Visual Studio

I ran FxCop on one of the projects I'm working on, and I got a lot of warnings that look like this:

CA1703: Microsoft.Naming: In the resource 'MyProject.Properties.Resources.resx', referring to the name "MyString", correct the spelling "Myyyy" in string value "Some format string: {0: dMMMyyyy} '

Since resources are a generated class, I cannot just suppress these messages using the usual mechanism. Does anyone have any bright ideas on how I can get around this problem?

Change . Just to make everything clear (since I did not know that it was different with Team System), I'm not interested in Team System solutions - in particular, for MS Visual Studio Pro 2008.

+3
source share
4 answers

In the end, I turned off the spelling of resources, setting the neutral assembly language to nothing, for example, in AssemblyInfo.cs, I added this line:

[assembly: NeutralResourcesLanguage("")]

This is as suggested here .

+3
source

If you do not want the naming rules to be applied to resources, simply disable this rule in the project settings.

  • Right-click the project in the project tree
  • Click Properties
  • " "
  • " "
  • CA1703

, . .

  • CA
  • " ()"
  • " "
+3

, , :

Project > Options > Spelling & Analysis
Check Suppress analysis results against generated code
+1

FxCop () .

CustomDictionary.xml. XML, ( ) node.

<Dictionary>
    <Words>
        <Recognized>
               <Word>aNewWord</Word>
               <Word>AnotherNewWord</Word>
        </Recognized>
    </Words>
</Dictionary>

, FxCop ( C:\Program Files\Microsoft FxCop). , , . , FxCop . Visual Studio Action Action CodeAnalysisDictionary.

+1

Source: https://habr.com/ru/post/1714484/


All Articles