58.5. Team Foundation Build

Team Foundation Build is a tool, part of TFS, and its responsibility is to get the latest version from Source Control to a local workspace, build the projects as configured, run tests, do other MSBuild tasks, and finally report the results and leave the output in a shared folder. We will refer to a computer with TFB installed as a build agent.

MSBuild is the build platform for Microsoft and Visual Studio. It can be run from the command line and extended using Custom Tasks, which includes tasks such as copy, makedir, and C# compiler (csc).

To create a new build definition right-click the Builds folder in Team Explorer and select New Build Definition (Figure 58-21). In the General tab you need to write the build name and optionally a description. Configuring the workspace will be used in complex scenarios where you have dependencies between team projects, so the defaults in that tab might be enough.

Figure 58.21. Figure 58-21

You can select an existing MSBuild project in the Project File tab or create a new one (Figure 58-22). To create one, select which solutions to build, in which configuration (that is, debug, release, custom ones), and finally decide which test to run and if code analysis will be performed.

Figure 58.22. Figure 58-22

In the build defaults you can choose a build agent and a shared folder to drop the output into. These will be used for triggered builds, but for manual builds this can be overridden. The retention policy will let you choose how the builds left in the shared folder will be deleted. I would recommend the Keep All option now with adjustments as necessary.

By default the build has to be manually queued, but in the Trigger tab you can modify this behavior. You have four options, as shown in Figure 58-23. I would recommend choosing "Build each check-in"; this will generate more builds and has many advantages. If a build breaks or a test fails, you will know exactly which build caused it and the error will be easier to detect. Depending on how big your project is, how long it takes to build and run the tests, and how often the team checks in, this option may cause some overhead. The third option, "Accumulate check-ins until the prior build finishes," will definitely help alleviate the workload, but it's better to wait until you find you need it.

Figure 58.23. Figure 58-23

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.12.207