What is the best way to run and report Visual Studio 2012 code analysis in TeamCity?
Since FxCop or Code Analysis integrates directly into MsBuild, it's probably as simple as adding /p:RunCodeAnalysis=Always
or /p:RunCodeAnalysis=True
to the MsBuild commandline when building the project. Since this will generate standard compiler warnings, TeamCity should pick them up automatically.
Visual Studio 2010+ Code Analysis is (based on) FxCop 10.0. You can simply add a 'FxCop' build runner type build step.
When the 'Report XSLT file' setting is configured the build runner will output a HTML report. FxCop 10.0 includes a default XSLT file under '%system.FxCopRoot%/Xml/FxCopReport.xsl' to generate a default HTML report.
来源:https://stackoverflow.com/questions/19569097/running-and-reporting-visual-studio-2012-code-analysis-in-teamcity