Welcome to my series of posts on the new Team Foundation 2015 Build system.
Part I – Team Foundation Build 2015 Overview
The build system in TFS has evolved over the years since it debuted. Originally Team Build was MSBuild based and provided many features but required a good understanding of XML and Targets. In TFS 2010, the build system was rebuilt to utilize the Windows Workflow and be XAML based. This new build system provided a better user interface and a tremendous amount of customization and extensibility, so much that it appeared to be overly complex. To make a simple change or add a step required a lot of discovery of where to put it and in many cases requiring the change in multiple places.
In 2015, a new build system has been added to TFS 2015 and Visual Studio Online that provides an easy to use web interface with a tremendous amount of built it build tasks. The system is not only designed to build Visual Studio/.NET solutions as it has traditionally been able to do, the new build system is designed from the ground up to be cross platform to build and have agents that run on a number of different platforms. In addition to the out of the box support, the new build system also easily allows us to add additional functionality by simply calling PowerShell scripts. Finally, this new build system will provide the foundation for new and exciting DevOps capabilities shown to us at //Build last month that include web based release management, distributed testing, and Azure Dev/Test.
The new build system is now available in Preview in the TFS 2015 RC and in Visual Studio Online. Getting started is easy. With Visual Studio Online, you can configure your own build agent (yes, a build controller is not longer needed) or use the hosted build pool.
Let’s look at a few features in the new build system:
Web Based Build Creation and Management
Everything from build creation to execution and management of results is through an easy to use, web based interface. In fact even if you select create build or click on a build to display the build details, this brings up the web interface.
As you can see from the image above, the new build system includes out of the box templates for building Visual Studio, Xamarin, and Xcode projects. In addition to the templates, there are a number of tasks included for performing actions on various platforms. The image below shows several tasks for steps to perform when building Android apps.
The build system includes dozens of tasks organized by multiple categories including build, utility, test, package, and deploy.
Wondering what is happening in any of the tasks? The tasks are essentially consist of PowerShell scripts and JSON files. To take a look at the code of the tasks, the code is stored in the vso-agents-tasks open source repo on GitHub.
Use PowerShell for Custom Tasks
Some builds require custom steps that won’t be found in the included tasks. Fortunately the build system is easy to extend and perform customized functionality. This is performed by calling a PowerShell script or other scripting language depending on your platform. With a PowerShell script, you can pass in build variables through arguments or access the build variables directly within your script.
Managing state and settings between the definition and the template was complex in XAML builds. In the new build system, this is easy and provides a secure way for storing sensitive values such as a password so others can open the definition without knowing the values. This also removes the need for passwords being added to source control in scripts like what was required in previous systems.
Build Definition Versioning
Have you accidentally saved a change in a build definition or someone else made a change that you wish you could revert back? I have often wish I could see what a previous setting in a build definition. This was not tracked and available in previous systems.s However, in the new build system each time you save the definition, you will be prompted for a comment and it will save this as a new version. In addition, you can also save as a draft and even it run it before it is published publicly.
In addition to storing the history, the tool provides the ability to compare previous version and visualize the differences using the Diff feature.
Additional Resources on MSDN
Use your free 60 minutes of hosted build minutes to start trying out the new build system on Visual Studio Online. MSDN provides a number of resources to getting started with the new build system.