I run a fairly-large team (5 solutions, ~150 projects), using TFS2010 and gated check-ins. In our team, we mandate that each project import a file of our own called Common.Targets, which does a bunch of build-time stuff. I’ve instructed everyone on the team to do that, and wrote a wiki entry on it too.
However, people still forget to import common.Targets when adding a new project, causing all sorts of trouble after check-in.
Is there a way – an msbuild commandline, something I can put in my .sln’s, etc. – that such a project would fail to compile, and therefore would not pass the gated check-in?
2 options:
As suggested by KMoraz, author a custom check-in policy (How To) which parses changed/added .csproj as XML and validates that they import Common.Targets.
Con: Need to distribute this manually to all developers in the team, and manage updates if there are any.
Author a custom CodeActivity (How To). It runs msbuild MSBuildEmitSolution=1, parses the resulting .sln.metaproj as XML to get the list of csproj files, and then validates them as above.
Con: Developer only sees the error when his gated check-in fails.
I decided to go with 2.