Monday, January 19, 2015

How to integrate StyleCop with Jetbrains TeamCity

If you want to integrate StyleCop with Jetbrains Teamcity, unfortunately, there is no built-in Runner for StyleCop in Jetbrains TeamCity, but you can use a combination of these tools in order to execute your StyleCop tasks and generate a report that can be displayed through the TeamCity Web User Interface:

  1. Download MSBuild Extension Pack from here:
  2. Once you have downloaded and installed MSBuild Extension Pack, if you have not already done so, download and install StyleCop:
  3. You will then need to copy the MSBuild.ExtensionPack.StyleCop.dll into the StyleCop directory
  4. Download the StyleCop.xsl file from this location:
  5. Within an MSBuild Target, use the MSBuild Extension Pack StyleCop Task to generate your StyleCop report.
  6. Then use the XslTransformation Task in MSBuild to transform the StyleCop XML Report file against the XSL file you downloaded, to produce an HTML Report.
  7. Use these instructions to create a Report Tab in TeamCity for your StyleCop Report: 
  8. Use the TeamCity MSBuild Service Tasks to publish information about your StyleCop results such as your StyleCop Artifacts, your Report Statistics or if you want to fail the build:
That is all that is required to be able to publish your StyleCop results in TeamCity!

No comments:

Post a Comment