如何集成FxCop和VS 2008?
如果这是重复的问题,请指出正确的链接,我将删除该问题。
我知道在 VS Team System 中我可以使用代码分析,但我使用的是 VS Professional。
您能告诉我如何集成 FxCop 和 Visual Studio 吗? 我不想将 FxCopCmd.exe 添加到我的构建后事件中以在每次编译时运行 FxCop。 当我通过右键单击解决方案资源管理器中的项目进行选择时,我希望能够运行 FxCop。
感谢您的帮助。
If this is duplicated question, please point me to the proper link and I'll delete this question.
I know that in VS Team System I can use Code Analysis but I'm using VS Professional.
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.
Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我花了一段时间才终于弄清楚。 这并不理想,但它有效。
更新:
我使用 分步说明创建帖子:
感谢 aamit,他提供了使我走上正轨的链接,甚至是 MSDN 文章中的解决方案不起作用。 给他+1; 他应得的。
1.) 在 FxCop GUI 中保存您的项目。
重要
你的解决方案在哪里。
与您的解决方案名称相同并且
包括 .sln 扩展名。
例如:如果您的解决方案名称为
MySolution.sln
,则 FxCop 项目名称将为MySolution.sln.FxCop
。2.) 在 Visual Studio 中选择工具 -> 外部工具
3.) 在外部工具对话框中输入以下信息:
FxCop 1.36\FxCopCmd.exe
/p:"$(SolutionDir)\$(SolutionFileName).fxcop"
/cXsl:"C:\Program Files\Microsoft
FxCop 1.36\Xml\VSConsoleOutput.xsl"
Files\Microsoft FxCop 1.36
确保选中“使用输出窗口”复选框。
就是这样。 它对我有用,我希望它对你也有用。
It took awhile by I finally figure it out. It's not ideal but it works.
Update:
I create a post with step by step instructions:
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.) In FxCop GUI save your project.
IMPORTANT:
where your solution is.
same as your solution name and
include the .sln extension.
For example: If your solution name is
MySolution.sln
, the FxCop project name is going to beMySolution.sln.FxCop
.2.) In Visual Studio select Tools -> External Toos
3.) Enter following information in External Tools dialog box:
FxCop 1.36\FxCopCmd.exe
/p:"$(SolutionDir)\$(SolutionFileName).fxcop"
/cXsl:"C:\Program Files\Microsoft
FxCop 1.36\Xml\VSConsoleOutput.xsl"
Files\Microsoft FxCop 1.36
Make sure that "Use Output window" checkbox is checked.
That's it. It works for me I hope it's going to work for you.
如何将 FxCop 设置为 Visual Studio 中的外部工具? 链接如下:
http://msdn.microsoft.com/ en-us/library/bb429389(VS.80).aspx
How about setting up FxCop as an external tool in Visual Studio? Here's the link:
http://msdn.microsoft.com/en-us/library/bb429389(VS.80).aspx
我运行一个与 Vadim 非常相似的命令作为项目的构建后事件。 这样,我一重新编译就会收到 FxCop 错误。 但我们的命令几乎是一样的; 很高兴知道世界上至少有两个人得出了相同的结论!
这些错误确实显示在 Visual Studo 的错误列表窗格中。
/dictionary 参数;它仅指向我的自定义字典文件之一,因为 FxCop 将一些变量名称标记为匈牙利表示法,而实际上它们不是。为了便于阅读,我还对命令进行了换行。)
(您可以省略 构建时间稍长一些,但很高兴立即看到错误并根据项目定制命令设置。 祝你好运!
I run a command very similar Vadim's as a Post-Build event for the project. That way, I get the FxCop errors as soon as I recompile. But our commands are pretty much the same; nice to know at least two people in the world reached the same conclusion!
The errors do show up in Visual Studo's Error List pane.
(You can omit the /dictionary argument; it just points to one of my custom dictionary files since FxCop flags a few variable names as Hungarian notation when they aren't. I also line-wrapped the command for readability.)
It does make the build a little longer, but it's nice to see the errors right away and to tailor the command settings per project. Good luck!