Specify a custom dictionary for FxCop and Visual Studio source analysis
- by Marko Apfel
Renaming the default custom dictionary from CustomDictionary.xml to an other name – for instance FxCop.CustomDictionary.xml needs some additional changes to work in involved applications. Visual Studio Team System code analysis For Visual Studio Team System code analysis this file should be added as a link to all projects and setted to be the Build Action CodeAnalysisDirectory. Build target In a build target the command line tool FxCopCmd should be called with the /dictionary parameter: <Target Name="FxCop">
<Exec
Command=""$(ProjectDir)..\..\build\FxCop\FxCopCmd.exe"
/file:"$(TargetPath)"
/project:"$(ProjectDir)..\EsriDE.SfgPraxair.FxCop"
/directory:"$(ProjectDir)..\..\lib\Esri.ArcGIS"
/directory:"$(ProjectDir)..\..\lib\Microsoft"
/dictionary:"$(ProjectDir)..\FxCop.CustomDictionary.xml"
/out:"$(OutDir)..\$(ProjectName).FxCopReport.xml"
/console /forceoutput /ignoregeneratedcode">
</Exec>
<Message Text="FxCop finished." />
</Target>
FxCop-GUI (standalone application)
In FxCop-GUI is no option to specify an own file name – but you could add a hint in the FxCop project file.
Open your this file and look for the line:
<CustomDictionaries SearchFxCopDir="True" SearchUserProfile="True" SearchProjectDir="True" />
Then change it to:
<CustomDictionaries SearchFxCopDir="True" SearchUserProfile="True" SearchProjectDir="True">
<CustomDictionary Path="FxCop.CustomDictionary.xml"/>
</CustomDictionaries>
Ready :-)