There have been several times when folks have needed to run a custom target prior to building each solution (or project) in Team Build. Unfortunately, there’s no good way to do this. Manish Agarwal describes (mostly) how to do it in his post, How to call a custom target after building each individual solution (sln) in Team Build? The solution he gives involves overriding the CoreCompile target.
The CoreCompile target, along with many other Core* targets, is changing for the next release of Team Foundation Server. The changes are due to the need to support new features in the product, along with greater flexibility. So, if you go that route, you will need to adjust your build files down the road when you upgrade to the next release. For a list of targets that you can safely override, see Team Build Extensibility.
One bit of good news is that we are working to address this in a future release and make it possible to cleanly inject your targets before or after (or both!) each solution is built.
One user, Steve St. Jean, describes his experience with this trying to do this. He ultimately was able to take a different approach to solve his problem.
- TFS Team Build: Problems with calling a custom target before building each individual solution – Part I
- TFS Team Build: Problems with calling a custom target before building each individual solution – Part II
Here are a few more useful tips from Steve’s blog.
- VSTS Team Builds: Getting diagnostic information into the log
- TFS Team Build SolutionRoot property
- How to install TFS Build Server on build machine so it uses a Service Account
Hopefully, he won’t have to add “by Team Build” to his blog’s title, “How Steve Got Burned Today.”