Specify path to CustomDictionary file for StyleCop spellchecking

Andrew Bezzub picture Andrew Bezzub · Oct 2, 2012 · Viewed 10.7k times · Source

Spell checking of the comments was added to the recent versions of StyleCop. It seems I can reuse my existing CustomDictionary file (that I created for FxCop) with StyleCop. SA1650 rule documentation does not say that it is possible. But in release notes for version 4.7.39 I see

Add support for specifying dictionary folders in the settings.StyleCop file.

How do I configure StyleCop to search for this file in the root folder of my solution?

Answer

Marek Dzikiewicz picture Marek Dzikiewicz · Jun 26, 2013

In my case it worked when I specified the custom dictionary entries in the Settings.StyleCop file located next to the .csproj file.

<GlobalSettings>
  <StringProperty Name="MergeSettingsFiles">NoMerge</StringProperty>
  <CollectionProperty Name="RecognizedWords">
    <Value>word1</Value>
    <Value>word2</Value>
    ...
  </CollectionProperty>
</GlobalSettings>

Actually, the StyleCopSettingsEditor.exe utility created these settings for me. I opened it using the project's context menu in Visual Studio, using the "StyleCop Settings" menu item.