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: https://github.com/mikefourie/MSBuildExtensionPack/releases
  2. Once you have downloaded and installed MSBuild Extension Pack, if you have not already done so, download and install StyleCop:  https://stylecop.codeplex.com/
  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: https://github.com/kopelli/VICI/blob/master/tools/StyleCop/v4.4.0.12/StyleCop.xsl
  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: https://confluence.jetbrains.com/display/TCD8/Including+Third-Party+Reports+in+the+Build+Results 
  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: https://confluence.jetbrains.com/display/TCD9/MSBuild+Service+Tasks
That is all that is required to be able to publish your StyleCop results in TeamCity!

No comments:

Post a Comment