I’ve upgraded from FxCop 1.35 to 1.36 and now FxCop has started to fire warnings against typed DataSets and other generated code. How do I turn this off?
The reason this is occurring is because we changed the way that FxCop analyzed generated code. Whereas previously in 1.35, FxCop would only ignore particular generated code (such as DataSets), FxCop 1.36 will now either ignore no generated code, or all generated code. The former is the default.
To change this behavior and have FxCop skip over generated code:
Using an FxCop project:
- Open your FxCop project in FxCop
- Choose Project -> Options -> Spelling & Analysis
- Check Suppress analysis results against generated code
- Click OK
Via the command-line:
- Pass the /ignoregeneratedcode switch, for example:
FxCopCmd.exe /file:MyAssembly.dll /out:AnalysisResults.xml /ignoregeneratedcode
For more information on FxCop’s behavior over generated code, see Correct usage of the CompilerGeneratedAttribute and the GeneratedCodeAttribute.