Jaa


Why does Team Build sync all sources inspite of my selecting only a subset of solutions?

I have encountered this q many times, asking why even though the user selects say one solution out of several solutions mapped to the team project to build, all solutions are still synced to the build machine while only the selected solution is built.

Build type wizard

In the second page of the build type creation wizard, you have a drop down where you can choose a workspace. Based on the mappings in the workspace, the list of solutions vary. Whichever solutions are mapped to the team project using the workspace that you have selected are displayed. For instance, you have say WS1 that maps Sln1 and Sln2 to team project TP and WS2 that maps Sln3 and Sln4 to the same team project. Then, upon selecting WS1 in the drop down, you can choose from Sln1 and Sln2 and upon selecting WS2 in the drop down, you can choose from Sln3 and Sln4. Of course, in the default selection of "All solutions mapped to team project", you can see solutions Sln1,2,3 and 4.

Now, consider you chose WS1 and decided to build only Sln1. The mappings in WS1 are extracted from the workspace and filtered such that only mappings to team project TP are chosen. In case the workspace WS1 had mappings to TP2, these mappings are discarded. Now, the selected mappings are written into the workspacemapping.xml file. This file is checked in along with the tfsbuild.proj file.

Now, suppose you kick off a build on the build type that you just created. What happens on the build machine is that the CreateWorkspace task creates a workspace based on the mappings of the workspacemapping.xml file. Then, the entire sources belonging to that workspace are synced on to the machine. Note that although you selected only Sln1 in the build type configuration wizard, the mappings were for both solutions. Hence, while syncing both solutions are synced on to the machine. Albeit when the Compile target is called, only the solution that was checked i.e. Sln1 is built in the build process.

However you may ask why we cannot filter mappings on solution selected and only choose mappings that belong to the selected solution. That is because we have no clue which mapping is for which solution(s). Since a workspace is the only atomic unit of syncing that the build process can know, it is not possible to selectively sync only the solutions chosen in the build type configuration wizard. This explains why even unselected solutions are synced onto the build machine but not built.