Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify path to CustomDictionary file for StyleCop spellchecking

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?

like image 941
Andrew Bezzub Avatar asked Oct 01 '12 23:10

Andrew Bezzub


2 Answers

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.

like image 82
Marek Dzikiewicz Avatar answered Oct 31 '22 03:10

Marek Dzikiewicz


Add a file named Settings.StyleCop in your solution root directory with the following content:

<StyleCopSettings Version="105">
  <GlobalSettings>
    <CollectionProperty Name="DictionaryFolders">
      <Value>**my-dictionary-folder**</Value>
    </CollectionProperty>
  </GlobalSettings>
</StyleCopSettings>

Where you replace my-dictionary-folder with the relative path to the folder containing your CustomDictionary.xml file.

like image 43
Boinst Avatar answered Oct 31 '22 02:10

Boinst