Search code examples
visual-studiocode-analysisresource-files

How do I get code analysis to ignore line breaks in my resource files?


Is there a way to get code analysis to ignore line breaks <br> when giving me spelling warnings about text in my resource files? I know I can add them to my code analysis dictionary but I'm pretty sure there is a way to get them ignored without that.

The warning is the standard CA1703 warning which for br tags gives me something like:

correct the spelling of 'br' in string value 'blah blah <br> blah'

This is a normal winform project using Visual Studio 2010.


Solution

  • Add a file called CustomDictionary.xml to your project

    That looks something like

    <?xml version="1.0" encoding="utf-8" ?>
    <Dictionary>
      <Words>
        <Recognized>
          <Word>br</Word>
        </Recognized>
      </Words>
    </Dictionary>
    

    or may be <br>, may be, never used it on tags.

    More info on it here VS Code Analysis and dictionaries