如何集成FxCop和VS 2008? [英] How to integrate FxCop and VS 2008?

查看:86
本文介绍了如何集成FxCop和VS 2008?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果这是重复的问题,请指向我正确的链接,然后我将删除该问题.

If this is duplicated question, please point me to the proper link and I'll delete this question.

我知道在VS Team System中我可以使用代码分析,但是在使用VS Professional.

I know that in VS Team System I can use Code Analysis but I'm using VS Professional.

您能告诉我如何集成FxCop和Visual Studio吗?我不想将FxCopCmd.exe添加到我的生成后事件中,以在每次编译时运行FxCop. 我希望能够在右键单击解决方案资源管理器"中的项目进行选择时运行FxCop.

Can you tell me how I can integrate FxCop and Visual Studio? I don't want to add FxCopCmd.exe to my Post-build events to run FxCop with every compilation. I want to be able to run FxCop when I choose by right clicking on the project in Solution Explorer.

感谢您的帮助.

推荐答案

花了一段时间,我终于弄明白了.这不是理想的方法,但是可行.

It took awhile by I finally figure it out. It's not ideal but it works.

更新: 我使用逐步说明创建帖子:

感谢 aamit ,他提供了使我走上正轨的链接,即使MSDN文章中的解决方案没有做到这一点'工作.给他+1;他应得的.

Thanks to aamit, who provided the link that put me on the right track even that solution in MSDN article doesn't work. Give him +1; he deserves it.

1.)在FxCop GUI中保存您的项目.

1.) In FxCop GUI save your project.

重要:

  • a.将项目保存在同一目录中 您的解决方案在哪里.
  • b.给FxCop项目命名为 与您的解决方案名称相同 包括.sln扩展名.
  • a. Save project in the same directory where your solution is.
  • b. Give the FxCop project name the same as your solution name and include the .sln extension.

例如:如果您的解决方案名称为MySolution.sln,则FxCop项目名称将为MySolution.sln.FxCop.

For example: If your solution name is MySolution.sln, the FxCop project name is going to be MySolution.sln.FxCop.

2.)在Visual Studio中,选择工具"->外部Toos"

2.) In Visual Studio select Tools -> External Toos

3.)在外部工具"对话框中输入以下信息:

3.) Enter following information in External Tools dialog box:

  • 标题: FxCop
  • 命令: C:\ Program Files \ Microsoft FxCop 1.36 \ FxCopCmd.exe
  • 参数:/c /p:$(SolutionDir)\$(SolutionFileName).fxcop" /cXsl:"C:\ Program Files \ Microsoft FxCop 1.36 \ Xml \ VSConsoleOutput.xsl"
  • 初始目录: C:\ Program Files \ Microsoft FxCop 1.36
  • Title: FxCop
  • Command: C:\Program Files\Microsoft FxCop 1.36\FxCopCmd.exe
  • Arguments: /c /p:"$(SolutionDir)\$(SolutionFileName).fxcop" /cXsl:"C:\Program Files\Microsoft FxCop 1.36\Xml\VSConsoleOutput.xsl"
  • Initial directory: C:\Program Files\Microsoft FxCop 1.36

确保已选中使用输出窗口" 复选框.

就是这样.它对我有用,我希望它对您有用.

That's it. It works for me I hope it's going to work for you.

这篇关于如何集成FxCop和VS 2008?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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