Inside TFS

A Primer on Microsoft Build Automation

If you've got a strong version-control system, implementing an automated build process is the next logical step.

Everyone wants to improve the quality of the software they build. One way to accomplish that goal is to implement a strong version-control system. The next step is to implement an automated build process.

One of the problems with software development is that you usually don’t see the product until it is in a finished state. The problem with this approach: how can you show progress to a customer? Being able to show the customer a running piece of software is a good way for them to know how things are going with the development effort, and for you to gauge your progress. Agile methodologies such as Scrum embrace this idea; at the end of each sprint, you have a functioning piece of software.

In theory, showing your customer a working version of your application seems like a good idea. In reality, it can be a complex task to accomplish. The problem is, assembling a working piece of software can take time, time that could be spent on other project tasks. So ideally, you want to be able to automate this build process, allowing you to both show progress and incorporate feedback from project stakeholders.

More Than Compiling Code
Build automation is the ability to assemble your application into a usable product with a simple, single action. Usually, build automation includes not just compiling the source code into binaries, but also running tests, creating documentation, and deploying the compiled code for manual testing.

Automating the build process takes some of the potential for errors out of the process. Most software applications are very complex, and manually building the software can take one or more full-time individuals. Even these individuals can get it wrong sometimes. Being able to automate your builds can stop errors from happening.

Developers in Visual Studio 2010 can run their applications by pressing F5. This compiles the code on the local workstation and runs it. However, it doesn’t ensure that the code works with the latest code from other developers on the project. It also doesn’t allow for running automated tests.

A build automation server makes it easy to compile the entire application, almost as easy as a developer pressing F5. The build automation server looks for changes in version control and automatically builds the project using the latest code in the version-control system. Usually, builds can be kicked off manually, on a timed schedule, or even on every check-in (this is known as continuous integration).

Scripting the Build
Before you can automate your build process, you need to script out the build so it can be executed with a single command. With Team Foundation Server, this is done using both MSBuild and Windows Workflow Foundation (WF). MSBuild is the build system used by Visual Studio and is part of the .NET Framework. Windows Workflow Foundation is a programming framework from Microsoft used for defining and executing workflows. Team Foundation Server makes use of both of these languages to automate the build process.

Once you have scripted the build process, the next step is to run it on a schedule. This helps remove yet another manual step from the process. Running the build on a separate build server also helps remove a developer’s machine from the equation, ensuring that all dependencies are accounted for in the application.

Team Foundation Server has provided build automation capabilities since TFS 2005. This process is referred to as Team Foundation Build. In TFS 2005, it was built heavily around MSBuild, but was rather limited. TFS 2008 offered many improvements to the build process, including multiple triggers for builds. TFS 2010 moved the build automation process to use WF as the primary engine.

While Team Foundation Build can only be used with TFS Version Control, you derive many benefits from this integration. Team Foundation Build can easily access information from version control, as well as the work item tracking system. And the reporting capabilities provided by TFS offer detailed information on the status of your builds.

Build automation is very important to your application lifecycle management, and Team Foundation Server provides some nice features around build automation. If you are serious about the quality of software you deliver, then you need to be serious about build automation.

About the Author

Mickey Gousset spends his days as a principal consultant for Infront Consulting Group. Gousset is lead author of "Professional Application Lifecycle Management with Visual Studio 2012" (Wrox, 2012) and frequents the speaker circuit singing the praises of ALM and DevOps. He also blogs at ALM Rocks!. Gousset is one of the original Team System/ALM MVPs and has held the award since 2005.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube