Setup code analysis in Visual Studio and Team City – Part II

In previous article Setup Code Analysis in Visual Studio and Team City, part I I have written how to setup solution and projects to enable FxCop in Visual Studio. Now I will focus on setup of Team City.

Setup Team City

Although everything is setup well in solution file and all project files, Team City needs to setup FxCop analysis in other way.

1. Setup FxCop for production code

  • Open ‘Setting’ page of project Build configuration.
  • Select ‘Build Steps’ tab.
  • Create a New Build Step.
    In general group:
  • Select ‘Runner type’ as ‘FxCop’.
  • In field ‘Step name’ write ‘Run FxCop for production libraries’.
  • And stay value for ‘Execute step’ in ‘If all previous steps finished successfully’.
    Execute Step for FxCop
    In ‘FxCop Installation’ group:
  • Select ‘FxCop detection mode’ as ‘Autodetect installation’.
  • Select ‘FxCop version’ as ‘10.0’.
  • In ‘Assemblies’ specify assemblies which should be analyze with production rule-set file.
    FxCop Installation
    In ‘FxCop options’ group:
  • Check on ‘Ignore generated code’.
  • In ‘Additional FxCopCmd options’ write ‘/ruleset:=”.\ca.ruleset”‘
    FxCop Options
    That is all step settings needed.
  • Save build step by pressing “Save..”
  • Move this step right after step “Build application”

2. Setup FxCop for unit-test code

Follow the steps described in the ‘Setup FxCop for production code’ chapter. The only difference are:
In general group:
* In field ‘Step name’ write ‘Run FxCop for test libraries’.
In ‘FxCop Installation’ group:
* In ‘Assemblies’ specify assemblies which should be analyze with unit-test rule-set file.
In ‘FxCop options’ group:
* In ‘Additional FxCopCmd options’ write ‘/ruleset:=”.\ca-ut.ruleset”‘

That’s all, now go write some code.

Leave a Reply

Your email address will not be published. Required fields are marked *