Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Development Edition
Naming Warnings
 Identifiers should be spelled corre...

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Visual Studio Team System
Identifiers should be spelled correctly

TypeName

IdentifiersShouldBeSpelledCorrectly

CheckId

CA1704

Category

Microsoft.Naming

Breaking Change

Breaking

The name of an externally visible identifier contains one or more words that are not recognized by the Microsoft spelling checker library. This rule does not check constructors or special-named members such as get and set property accessors.

This rule parses the identifier into tokens and checks the spelling of each token. The parsing algorithm performs the following transformations:

  • Capital letters start a new token. For example, MyNameIsJoe tokenizes to "My", "Name", "Is", "Joe".

  • For multiple capital letters, the last capital letter starts a new token. For example, GUIEditor tokenizes to "GUI", "Editor".

  • Leading and trailing apostrophes are removed. For example, 'sender' tokenizes to "sender".

  • Underscores signify the end of a token and are removed. For example, Hello_world tokenizes to "Hello", "world".

  • Embedded ampersands are removed. For example, for&mat tokenizes to "format".

The English (en) version of the spelling checker is used by default.

To fix a violation of this rule, correct the spelling of the word or add the word to a custom dictionary named CustomDictionary.xml. Place the dictionary in the installation directory of the tool, the project directory, or in the directory associated with the tool under the user's profile (%USERPROFILE%\Application Data\...).

  • Add words that should not cause a violation under the Dictionary/Words/Recognized path.

  • Add words that should cause a violation under the Dictionary/Words/Unrecognized path.

  • Add words that should be flagged as obsolete under the Dictionary/Words/Deprecated path. See the related rule topic "Use preferred terms" for more information.

  • Add exceptions to the acronym casing rules to the Dictionary/Acronyms/CasingExceptions path.

The following is an example of the structure of a custom dictionary file.

   <Dictionary>
      <Words>
         <Unrecognized>
            <Word>cb</Word>
         </Unrecognized>
         <Recognized>
            <Word>stylesheet</Word>
            <Word>GotDotNet</Word>
         </Recognized>
         <Deprecated>
            <Term PreferredAlternate="EnterpriseServices">ComPlus</Term>
         </Deprecated>
      </Words>
      <Acronyms>
         <CasingExceptions>
            <Acronym>CJK</Acronym>
            <Acronym>Pi</Acronym>
         </CasingExceptions>
      </Acronyms>
   </Dictionary>

Suppress a warning from this rule only if the word is intentionally misspelled and the word applies to a limited set of the library. Correctly spelled words reduce the learning curve required for new software libraries.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Getting CustomDictionary.xml to work in your projects      Daniel Smith   |   Edit   |   Show History
One vital bit of information is missing for a CustomDictionary.xml to work if you add it to your project - you have to right click the .xml file in the Solution Explorer and set the Build Action property to "Code Analysis Dictionary".
Re: Build Action      Zian Choy   |   Edit   |   Show History
That doesn't work in VS 2008 and VB 2008. Code Analysis Dictionary isn't in the drop-down list.
Tags What's this?: Add a tag
Flag as ContentBug
annoying      Novaleaf Software   |   Edit   |   Show History
this work-around posted by daniel smith works with C# in VS2008.

PS: bloody annoying trying to track this information down... props to Daniel.
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker