Visual Studio 2010代码分析 - 在解决方案上运行

Bri*_*ins 16 .net code-analysis visual-studio-2010 visual-studio

I would like to manually run code analysis for an entire solution, not on building the project, and not using FXCop, if possible. I did enable CA on build but it really, really slowed down the build process, and we can't have that. But it seems weird to me that code analysis can only be run per project manually through the menus, but not for an entire project.

Am I missing something?

Thanks.

Jef*_*ata 9

我也不知道可用于为所有项目运行CA的菜单/命令,但您可以创建新的解决方案配置(例如,基于Debug的CodeAnalysis)并为每个项目设置CA以运行该配置,让您为所有项目运行CA而不会降低常规Debug构建的速度.

  1. 创建名为"Code Analysis"的新配置(Build - > Configuration Manager,然后在Active solution configuration下<New ...>).

  2. 在每个项目的CA属性选项卡中,将CA设置为"代码分析"配置运行,而不是运行调试配置(以及您不希望CA运行的任何其他配置).

  3. 如果您通常不希望在常规构建配置上进行合同检查,则可以在"代码约定"选项卡上执行相同操作.

现在,当您将解决方案配置设置为Debug和build时,您不应该执行CA和CC.如果确实需要完成CA和CC检查,请将配置更改为"代码分析"并进行构建.

它不像菜单或工具栏选项那么方便,但它可能是适合您的替代方案.

希望这可以帮助.