FxCop Build Step Questions and Issues

Hello,




I am running Teamcity on
OS: Windows Server 2012

version
Build: 8.1.2 (build 29993)


I am currently running a build agent with Visual Studios 2013 installed and I want to have TeamCity build code analyses for my projects with the FxCop build runner.  I also want to email the code analysis results to the users I assigned to the project in Team City.

Here are my questions:

1) How do I go about creating an FxCop build step to run Code Analysis for my Visual Studios 2013 C# .Net projects?  (TFS is my source control).

Since I am currently using VS2013 I am technically using FxCop version 12.0 without a stand alone installation.
When I tried specifying the installation root to the tool in my Program Files I receive this error

Cannot run process C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\FxCop\FxCopCmd.exe\FxCopCmd.exe /forceoutput /gac /ignoregeneratedcode /f:myprojectassemblies.dll /out:C:\TeamCity\BuildAgent\temp\buildTmp\fxcop-output-2227917996369366933\fxcop-result.xml : file not found

I even tried specifying the Report XSLT file "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\FxCop\Xml\FxCopReport.xsl"
and I still get the same error.


2) What do I need to do to create and email the results file or the contents of the results file of the Code Analysis build via TeamCity?

2 comments
Comment actions Permalink

Hi Ramsey,

> 1) How do I go about creating an FxCop build step to run Code Analysis for my Visual Studios 2013 C# .Net projects?  (TFS is my source control).

Installation root should be a directory where FxCop is installed. Please try "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\FxCop", without FxCopCmd.exe

If "Autodetect installation" option does not work for your case, please post an update with all the agent's system and configuration parameters (as seen on the Agents pages in TeamCity web UI) for the agent where VS is installed.


> 2) What do I need to do to create and email the results file or the contents of the results file of the Code Analysis build via TeamCity?

There is no easy way to email the code inspections results inside the email. Regularly, only the buld status and a link to see details in TeamCity UI is sent.

You can customize notification template but only in the scope of adding more details available via exposed objects. TeamCity-displayed code inspection report is not easily accessible for the notification template, you can only get summary data available from the build status. For the future you might be interested in ability to attach files to the notification email, requested by the feature request.

0
Comment actions Permalink

I also have an issue with specifying an FxCop ruleset with the FxCop build runner. I tried adding the additional command
/ruleset:"=c:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\Rule Sets\SecurityRules.ruleset"
which ends in a switch error. I even tried creating my own ruleset reference within my project but the Standard rulesets are still unavailable

[16:30:26]FxCop warning: Keyword=CA0063 Kind=Engine Type=Microsoft.FxCop.Sdk.FxCopException * Failed to load rule set file 'securityrules.ruleset' or one of its dependent rule set files. Could not locate the rule set file 'securityrules.ruleset'


How can I specify a ruleset in the FxCop build runner?

0

Please sign in to leave a comment.