views:

339

answers:

2

;) Yeah. I also have C++ in my solution.

How do I add a custom dictionary there? There is no tool for an includes file, as well as no way to tell it the type is CustomDictionary.

THe advice and approach shown in http://msdn.microsoft.com/en-us/library/bb514188(v=VS.100).aspx is not usable for C++ projects.

+6  A: 

To get a CustomDictionary working with C++ you will have to edit the project file manually as described here.

mathmike
This only works for VS2008.
Hans Passant
Yes, thus my downvode - sorry.
TomTom
+3  A: 

For VS2010, you can set the dictionary by editing your .vcxproj file and pasting this:

  <ItemGroup>
    <CodeAnalysisDictionary Include="c:\temp\mydictionary.xml" />
  </ItemGroup>

Modify the path to your dictionary.

To make this a permanent setting for all your C++ projects, navigate to c:\program files\msbuild\microsoft.cpp\v4.0 and edit Microsoft.Cpp.props, pasting the above (make a backup please).

To verify that the change is effective, use Tools + Options, Projects and Solutions, Build and Run, MSBuild project build log file verbosity = Diagnostic. Rebuild your project, look in the .log file and verify that fxcopcmd.exe got started with the /dictionary option.

Both approaches worked well on my machine.

Hans Passant
Could you add - how do I reference the project directory in there? I do not want a full path, thanks to continous integration building in a separate path.
TomTom
and - I just add a complete itemgroup?
TomTom