Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2013 Code Analysis Custom Dictionary Not Working

I'm trying to use visual studio's code analysis feature. Unfortunately (or fortunately?), I live in Canada and the code analysis complains about my spelling of the word "colour". I'm trying to use a custom dictionary but VS2013 seems to be ignoring it.

Here's the location of the dictionary relative to the project (and solution):

enter image description here

Here's the content of the dictionary file:

<Dictionary>
  <Words>
    <Unrecognized>
      <Word></Word>
    </Unrecognized>
    <Recognized>
      <Word>colour</Word>
    </Recognized>
    <Deprecated>
      <Term PreferredAlternate=""></Term>
    </Deprecated>
    <Compound>
      <Term CompoundAlternate=""></Term>
    </Compound>
    <DiscreteExceptions>
      <Term></Term>
    </DiscreteExceptions>
  </Words>
  <Acronyms>
    <CasingExceptions>
      <Acronym></Acronym>
    </CasingExceptions>
  </Acronyms>
</Dictionary>

I've also tried culling down the content of the custom dictionary to:

<Dictionary>
  <Words>
    <Recognized>
      <Word>colour</Word>
    </Recognized>
  </Words>
</Dictionary>

Does anyone know what's going on and how I can fix this?

like image 692
Paymahn Moghadasian Avatar asked Feb 13 '23 04:02

Paymahn Moghadasian


1 Answers

You shouldn't need to use a custom dictionary for this. Instead, if you're using Canadian spellings consistently in your code base, you can use the CodeAnalysisCulture MSBuild property to specify use of en-CA as the language in which spelling rules should operate. e.g.:

<CodeAnalysisCulture>en-CA</CodeAnalysisCulture>

In order for Visual Studio to recognize the custom dictionary make sure you set the build action on the XML file to CodeAnalysisDictionary. See this page for more info: To apply a custom dictionary to a project

like image 130
Nicole Calinoiu Avatar answered Feb 16 '23 04:02

Nicole Calinoiu