C ++ Code Analysis - how to add a custom dictionary?

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

How to add a custom dictionary there? There is no tool for the include file, and there is no way to tell it that it is a CustomDictionary type.

The tip and approach shown at http://msdn.microsoft.com/en-us/library/bb514188(v=VS.100).aspx cannot be used for C ++ projects.

+4
source share
2 answers

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

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

Change the path to your dictionary.

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

To make sure that this change is effective, use Tools + Options, Projects and Solutions, Build and Run, Project Project Log File MSBuild verbosity = Diagnostics. Rebuild your project, look in the .log file and make sure fxcopcmd.exe is running with the / dictionary option.

Both approaches worked well on my machine.

+7
source

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

+6
source

Source: https://habr.com/ru/post/1307357/


All Articles