Rory Primrose

Learn from my mistakes, you don't have time to make them yourself

View project on GitHub

VS2008 Code Analysis Dictionary

VS2008 Code Analysis has new features that provide spell checking. This is really great, but sometime you need to provide some additional information as to what valid words are. This is normally due to the spell checker not knowing your company name and product names. Quite understandable and thankfully it is configurable.

If you look at the help for the Identifiers should be spelled correctly rule, it refers to a custom dictionary. Unfortunately, the help documentation is quite unhelpful where it indicates where the CustomDictionary.xml file is stored:

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...).

Which tool? I can only assume that it is referring to the Visual Studio IDE? Why is this not specific? The project directory reference is self explanatory, but the users profile directory is as useful as the first reference to ‘the tool’.

If you click the How to: Customize the Code Analysis Dictionary link at the bottom of the help page, you get some mildly more helpful help information as it says:

To use the custom dictionary with all projects, put the file in the Visual Studio root install folder and restart Visual Studio. For a project-specific custom dictionary, put the file in the project folder.

I say mildly, because what is the Visual Studio root install folder? I would assume that to mean C:\Program Files\Microsoft Visual Studio 9.0, but it could also be C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE which is where devenv.exe lives.

Turns out that neither are correct. If you run a search over the root install folder for CustomDictionary.xml, you will probably find that the file is found in C:\Program Files\Microsoft Visual Studio 9.0\Team Tools\Static Analysis Tools\FxCop. Editing the xml file in the FxCop directory does the trick.

So the tool is FxCop, not Visual Studio, and the references to the Visual Studio root install folder are just wrong.

I think this tool is absolutely fantastic, but the help documentation really lets it down.

Written on December 6, 2007