如何在Visual Studio 2010 Professional中启用代码分析? [英] How to enable Code Analysis in Visual Studio 2010 Professional?

查看:119
本文介绍了如何在Visual Studio 2010 Professional中启用代码分析?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到我们可以在Visual Studio Team Systems中启用代码分析.但是我正在使用Visual Studio 2010专业版.

I can see that we can enable code analysis in Visual Studio Team Systems. But i am using Visual Studio 2010 Professional.

我们是否可以选择启用此版本中的代码分析功能,还是可以将诸如FxCop和StyleCop之类的任何工具与此版本集成在一起以验证代码.

Do we have any option to enable code analysis in this version or can we integrate any tools like FxCop and StyleCop with this version for validating the code.

我希望我的代码在构建解决方案的那一刻就可以得到分析.

I am expecting my code should analysied the moment i build my solution.

如果有人意识到这一点,请给我分享一些解决方案.

If somebody aware of this, please share me some solution for this.

推荐答案

您可以在解决方案的构建后事件中通过命令行集成FxCop.

You can integrate FxCop via Commandline in the post-build event of the solution.

下载FxCop 1.36并将以下命令添加到构建后事件中:

Download FxCop 1.36 and add following command into the post-build event:

"$(ProgramFiles)\Microsoft FxCop 1.36\FxCopCmd.exe" /c /p:"$(ProjectDir)\FxCop$(ConfigurationName).FxCop" /consolexsl:"$(ProgramFiles)\Microsoft FxCop 1.36\Xml\VSConsoleOutput.xsl"

通过consolexsl参数对输出进行格式化,以便将输出包含在VisualStudio builderrors和-warnings中.

Via consolexsl parameter the output is formatted so that the output is included into you VisualStudio builderrors and -warnings.

我们创建了一个FxCop文件,该文件指定了FxCop-Gui的规则.该文件已加载到命令中.

We have created a FxCop file that specifies the rules with FxCop-Gui. That file is loaded in the command.

这篇关于如何在Visual Studio 2010 Professional中启用代码分析?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆