StyleCop & TFS

Jul 19, 2010 at 1:58 PM

Hey guys,

i am not sure if it's the write message board to post, but i hope so!

Actually I am trying to integrate StyleCop into Team Foundation Server. After a check-in I want to check this file against my StyleCop-Rules. Next step is it to send an e-mail with the warnings (if there are) to the user who checked-in these files.

My problem is it to check with StyleCop AFTER check-in and to send the mail to the specific person.

Thanks in advance!

Best regards,

Aug 2, 2010 at 4:39 PM

You'd need a custom MSBuild task to do what you're proposing that would need to exist on your build server. TFS Check In policies are executed only before the files are checked in. You could easily put a condition on execution of your task to be something fed to the project within your TFSBuild.proj file. My advice would be to have StyleCop check the files before they get checked in. If someone else pulls the files down that are not formatted properly, makes a change, and checks the file in they will get an email from your process. Even if they weren't the person that checked in the malformatted code in the first place.

I've already got a policy available on CodePlex (that I just updated to use earlier this morning) that might do what you need it to: