简体   繁体   中英

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)?

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

FromFxCop 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.

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 .

您可以跳过程序集或规则(使用 FxCop.exe 中的复选框跳过规则或程序集。甚至为 FxCop 创建新规则以适合您的标准。FxCop 还提供您不想验证的类的属性。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM