Search code examples
tfsstylecop

Stylecop Checkin Policy VS2012, TFS2010


We have StyleCop as part of the project and every time we compile, Stylecop is checking the code. But we already have 100K+ lines of code and it only grows every day. So rebuild of the solution is taking longer and longer than 20 seconds already. I think that the worst part of it is Stylecop.

So we are thinking of the way to remove StyleCop from compilation process, but have it as check-in policy for TFS. I have found 2 projects: SourceAnalysysPolicy and StyleCopPolicy. But neither seem to support VS2012 and numerous posts online suggest they do not work in VS2012.

I can slap StyleCop as a step into our build server (TeamCity), but then we'll have a lot of false failed builds - not really a solution.

I was hoping to have to force all check-ins in TFS to be gated check-ins and run stylecop there via MSBuild script: if no violations - actually check-in and pass control over to TeamCity. If there are violations - warn the developer and not check-in. But I've no idea if that is possible in TFS2010 and how to implement it.

Any other ideas?


Solution

  • I know it's an older post but I just released a check-in policy for Visual Studio 2013. I don't know if you already using VS2013 but take a look at this extension. If you want VS2012 support, you can add an issue. If there are enough votes I will add support for it. https://stylecopcheckinpolicy.codeplex.com/