Using a custom dictionary in code analysis

see also Working with Microsoft FxCop As described in the previous post a custom dictionary could be referenced in a FxCop-call of a target by using the opti...

see also Working with Microsoft FxCop

As described in the previous post a custom dictionary could be referenced in a FxCop-call of a target by using the option:



/dictionary:"$(ProjectDir)..\FxCop.CustomDictionary.xml"

But how is it possible to publish this custom dictionary for the Visual Studio integrated code analysis?

This analysis runs an other FxCop.exe than my special FxCop-target. So the custom dictionary which is specified in the FxCop-call of my target is not used.

The solution is very simple. Because every project gets the FxCop-target the information about the custom dictionary could be inserted there.

This is done with the section:

<ItemGroup>

    <CodeAnalysisDictionary Include="&quot;$(ProjectDir)..\FxCop.CustomDictionary.xml&quot;" />

</ItemGroup>

Visual Studio code analysis uses this information. So with one line all projects are satisfied.