TFS2012: Create Build Definitions
In this article I will explain how to create a build definition in the Visual Studio 2012 and TFS 2012 server. I used TFS 2012 Express when I wrote this post. In a previous post, I went through the build types that Team Foundation Server supports.
To run a Team Build in TFS, assuming you already setup the Build Controller and Agents, you need to create a build definition. A build definition acts as a settings or configurations file for the build process.
Create Build Definition
The following steps show how to create a team build definition:
Open Visual Studio 2012
Open Team Explorer (View—>Team Explorer)
Connect to a TFS Server and Team Project
After you are connected to the Team Project of interest, go back to the Home menu or page and click on the Builds link
Click New Build Definition to create a new build definition
Give your build definition a meaningful name (e.g. mypp-CI-Debug, myapp-Scheduled-UnitTests).
Queuing process option is sufficiently explained on the screen.
Click on the Trigger node
On this screen, you can specify the build type. Build types were covered in the previous article. Under Rolling builds, Build no more often than ever x minutes means you want at least x minutes between builds to allow for build accumulation. Under Gated Check-in, check the Merge and build up to x submissions, if you want to group submissions when building them to improve performance.
The next step is to configure the Workspace.
On this screen, you can select as many folders as you want. Those folders and their contents will be downloaded (Get performed) to the Source Directory to the code. As a best practice, you want to avoid referencing the root folder of you team project (e.g. $/MyTeamProject) because you want to avoid getting the code for unrelated files or projects. Point to the folder where your code exists and add other folders for other related code or libraries such as libraries for third party controls. When adding multiple folders, make sure you maintain the folder level or relative path among folders at the Build Agent Folder.
Click on the Build defaults, it is probably called with that name because you can override these values when you queue a build <— I am guessing :)
On this screen, you have to specify a Build a controller and the drop folder location. The drop folder contains the output of the build process.
The Process screen is where you can define the Build process Template, which is a workflow of activities to execute your team build, and the Build process parameters that are passed to the workflow build template as arguments.
If you are using the Default Template, you need to at least populate the Items to Build parameter with a solution. Deferent build templates may have deferent parameters. You can also create and customize a build template.
Click the ellipsis button
Click on Add
Select a solution
You can select multiple solutions
You can set the configurations for the build in the Configurations tab
In another post, I will explain the other parameters.
The last step, is to define the retention policy. The retention policy automate the deletion of old builds to save disk space.
Save the build definition
Notice that it will be added to the build definition section on the build window. To queue a build manually, right click and click on Queue New Build