Search code examples
tfstfsbuildstylecop

StyleCop in TFS Build 2015


I want to be able to run a StyleCop analysis as a build step on our build definition, but am coming across some issues. I can't use this because our TFS policies forbid external build steps. I would prefer to not use this method either as it appears that it runs an analysis every time it builds (and we don't want this to happen on development machines).

Ideally I'd like to be able to run the analysis from batch or PowerShell as a build step, but that doesn't appear to be an option.

What methods are available that allow me to run a StyleCop analysis on an existing project (which already has StyleCop installed) as a build step in TFS Build, without it running each time the software is compiled on a development machine, and without adding too much bloat to the software?


Solution

  • You could check StyleCopCmdLine. StyleCopCmdLine is wrapper project to make it possible to easily call StyleCop from a command prompt or a PowerShell script.

    For a discussion of its usage within a TFS 2015 vNext build see this blog post.