Team Foundation Server Builds
Paul Zerkel
11/21/2013
Topics of Discussion
- Overview / What is a build server?
- How TFS acts as a build server
- How to create a build
- Automating Tasks
Team Foundation Server
Microsoft’s Application Lifecycle Management solution
- Task Tracking
- Source Control
- Bug Tracking
- Build Server
- Deployments
- Lab Management
- etc
What is a Build Server?
- A service often running on a dedicated machine
- Handles running build scripts based on an event
- Often keeps track of build artifacts, retrieves dependencies, logs results, keeps statistics
the heart monitor of your project -Jeff Atwood
Examples
- Team Foundation Server
- Jenkins
- Hudson
- Team City
- CruiseControl.net
Pros
- Centralized
- Repeatable
- Code Health Monitoring
- Continuous Integration
Cons
- Requires time to set up early on in the project.
- Another piece of infrastructure to maintain.
- Once you get used to automated builds, doing it by hand is a real pain.
Builds in TFS
Used for automated builds for code stored within Team Foundation System. Components include:
- Team Foundation Server
- Build Server
- Build Controller
- Build Agent
Small Team Infrastructure
source: MSDN
Large Team Infrastructure
source: MSDN
Visual Studio Online Infrastructure
source: MSDN
Build Process Template
- TFS 2010 moved from a MSBuild based build process to a Windows Workflow based build process
- The workflows are called Build Process Templates
- Edit them like a normal workflow
- Workflows have arguments that can be customized through the build UI as part of the build definition
Build Definition
A specific instance of a build which requires:
- Name
- Status
- Trigger
- Source Settings
- Build Defaults
- Process
- Retention Policy
Built in Features
- Unit Testing
- Code Analysis
- Deployments
- Labeling
Add-on TFS Activities
Assemblies must be checked into source control and the build controller must point to the custom assembly directory.
- Build your own
- Open Source (TFS Extensions)
Versioning
- Need to download and customize the workflow
- Can set how the version number is constructed
- Lots of customization available
StyleCop
TFS Extensions has a StyleCop activity that will run stylecop on the source files and report back as part of the build process.
- Helps enforce consistent code style throughout the project
- Can be customized per project
- Violations can be set as errors
Example Project Organization
The organization of your project within TFS is imporant. The root of a project should be broken up into areas that target different stages
of the software lifecycle.
Continuous Integration Example
A continuous integration build will run any time code is checked in. This gives you quick feedback on the state of the codebase.
- Set up email alerts for builds
- Create a build definition for the branch you're working in
- Pick Continuous Integration or Rolling Builds for the trigger
- Run unit tests, code analysis, and style checker
- Don't copy the output to the drop folder
- Turn off labeling
Release Example
A release build will target a branch in the Release folder. Release builds are intended to be deployed to environments outside of
the developer's machines such as Development, QA, and Production.
- Create a build definition for the release branch in question
- Each build should use a TFS Version task with the Major and Minor values set
- Set the build targets appropriately
- Make sure the project has configuration transforms as needed
- Label the build
- Select a reasonable spot on the network to store build results
- Unit testing, code analysis, and style checking is optional