views:

481

answers:

2

Hi

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

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.

thanks, Kiran

+1  A: 

Check out this comparison chart, built-in code analysis support gets checked starting in the Premium column.

Hans Passant
A: 

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

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"

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

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

Christoph Ungersböck