Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to integrate FxCop and VS 2008?

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.

like image 672
Vadim Avatar asked May 08 '09 20:05

Vadim


1 Answers

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:

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

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

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

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

  • 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

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.

like image 178
Vadim Avatar answered Oct 20 '22 17:10

Vadim