Wednesday, November 12, 2008

Adding a customdictionary.xml to your project for use with FxCop

Today I was cleaning up some code I wrote, so I decided to run FxCop on my project to help me identify possible issues. The first warning I ran into was a "misspelled" word. In fact it was a term from our Business Layer which was in dutch, so I wanted FxCop to ignore it.

Reading the help topic on this warning pointed me in the direction of the CustomDictionary.xml file, which allows you to influence the way spelling is checked by FxCop. The help topic states that you can define one on installation level for the tool, on user level or for the project. In this case I decided it would be part of the project so I would work for the rest of our team as well.

So I simply added a CustomDictionary.xml to my project, looking like this:


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


Obviously MyWord replaces the actual word I needed to add, but you get the picture. So I ran FxCop again and my "misspelled" word still raised a warning!!

Googling on this subject got me to Duncan's Blog, who wrote this post about it. Simply changing the Build Action on the CustomDictionary.xml file (in the properties) to CodeAnalysisDictionary did the trick.


By the way, please tell me what you think about my blog, by posting a comment. Thanks.

4 comments:

  1. I don't see this option in my Build Action. - What's happens?

    ReplyDelete
  2. Hi André, that's weird. Could you send me an email with a screenshot?
    Email: jvandeveen at gmail dot com

    ReplyDelete