locked
Selecting types or namespaces for code analysis

    Question

  • In FxCop I can chose the types and/or namespaces I want to have analized. I can't seem to find a way to do so in VS2010 code analysis. Is it just me or is this not possible?
    Thursday, July 29, 2010 12:33 PM

Answers

  • Yes, it's possible in VS2010, but there's no UI for creating the subset.  Instead, you'll either need to either specify the inclusion/exclusion list via the CodeAnalysisAdditionalOptions MSBuild property (using the /types command line parameter that will be used when running FxCopCmd.exe) or via a .fxcop project file specified via the CodeAnalysisProject MSBuild property.

    The latter approach caused problems in VS2008 since FxCop would attempt to load the target DLL twice if it was included in the project file.  I haven't tried it in VS2010, but it's certainly worth giving it a shot before resorting to the CodeAnalysisAdditionalOptions  approach.

    Thursday, July 29, 2010 1:19 PM