Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent FxCop from analyzing auto-generated code?

FxCop (tool for static code analysis) gives me an error while checking code behind of .edmx model. How to prevent FxCop from analyzing auto-generated code (or at least Entity Framework generated classes)?

like image 232
jwaliszko Avatar asked Feb 15 '11 16:02

jwaliszko


2 Answers

I have moved to Visual Studio Code Analysis, as it gives me the same functionality as FxCop.

From FxCop blog:

"That's correct, they are different products (FxCop and VS Code Analysys), however they do have a common engine. Visual Studio 2008 SP1 already comes with the same fixes and analysis (plus a little bit more), so there is no need to 'update' Visual Studio with the latest FxCop."

But nevertheless Suppress results from generated code option (project properties -> code analysis tab) for some reason does not preventing from code analysis for auto generated code of .edmx model.

Then I've found blog, which helped me solve this issue.

like image 171
jwaliszko Avatar answered Oct 30 '22 20:10

jwaliszko


I've used the /ignoregeneratedcode switch in the project that contained the auto-generated code that I did not want FxCop to analyze.

Here is an MSDN FAQ about how to prevent FxCop 1.36 from firing warnings against auto generated code.

like image 34
Andrew Thompson Avatar answered Oct 30 '22 18:10

Andrew Thompson