Custom Dictionary not working with Visual Studio 2010 Code Analysis

I can't seem to configure my CustomDictionary.xml correctly to address a couple of Code Analysis warnings I am getting in Visual Studio 2010.

The first is a namespace "Mvc" - just like the Microsoft provided namespace. I get:

CA1704: Microsoft.Naming: "Correct the spelling of 'Mvc' in namespace name 'xyz.Mvc.abc'

I've tried putting 'Mvc' in the acronyms section of the CustomDictionary like:

<Acronyms>
  <CasingExceptions>
    <Acronym>Mvc</Acronym>
  </CasingExceptions>
</Acronyms>

The warnings still appear. So, I tried putting an entry in the DiscreteExceptions node under the Words element - still nothing.

How can I properly tell CA that "Mvc" is correct?!?!

Btw, the same issue exists with an acronym representing a business unit within the company.

Secondly, I have the term "CheckOut" used in the code. It parallels a "CheckIn" method so I want it cased as I've indicated. CA says that the compound word should be cased "Checkout" and regardless where I put the entry in the CustomDictionary file, I still get the warning. How do I deal with this one?

Note: I do have the Build Action for the file set to CodeAnalysisDictionary and other terms are registering correctly. For some reasons, nothing I do seems to address these three.


You need to add the term to the recognized words section, not the casing exceptions section. eg:

<Dictionary>
    <Words>
        <Recognized>
            <Word>mvc</Word>
        </Recognized>
    </Words>
</Dictionary>
链接地址: http://www.djcxy.com/p/69040.html

上一篇: 是否可以合并或使用多个代码分析字典文件?

下一篇: 自定义词典不适用于Visual Studio 2010代码分析