34
“Welcome”

End To End Build Automation With Team Build

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: End To End Build Automation With Team Build

“Welcome”

Page 2: End To End Build Automation With Team Build

A few quick thanks…

New Horizons for providing facilities for our Hands On Lab day

Breeze Training for picking up the tab for the Brekkie & Newspapers

Microsoft for allowing us to use their great venue

Muffin Break for the wonderful breakfast served this morning

Page 3: End To End Build Automation With Team Build

VSTSTechBrekkie

• Final session coming up– 27th Oct 2006 - "Best Practices: Driving

up quality using VSTS (Test & Build)“ with Chuck & Marty

Page 4: End To End Build Automation With Team Build

VSTSTechBrekkie

• Hands on Lab day– Friday 10th November 2006– Free registration open for either of the

following sessions;• Morning 9:00 – 12:30

- or -• Afternoon 1:00 – 4:30

Supported by

Page 5: End To End Build Automation With Team Build

QLD VSTS Users Group

• Please complete registration form provided if you wish to register for the user group

• Current plan is for a Friday morning Breakfast event on 1st Friday of each month

• Inaugural meeting Friday 1st December 06• Website due in the next week or two

www.qvstsug.org

Page 6: End To End Build Automation With Team Build

“End to end build automation using Team Build”

William BartholomewDeveloper Productivity Specialist, TechnologyOne

Page 7: End To End Build Automation With Team Build

Who Am I?

• Developer Productivity Specialist TechnologyOne, Brisbane

• Technical Reviewer of Code Complete 2nd Edition by Steve McConnell

• Technical Reviewer of .NET Standard Library Annotated Reference Volume 2 by Brad and Tamara Abrams

• Member of Microsoft UI Frameworks Advisory Council (ASP .NET and Smart Client)

• MSDN Forum Moderator

Page 8: End To End Build Automation With Team Build

Agenda

• Introduction to MSBuild• Introduction to Team Build• Creating a Build Type• Executing a Build• Default Process• Editing Build Types• Build Process Customisation• Writing Custom Tasks• Resources

Page 9: End To End Build Automation With Team Build

Introduction to MSBuild

• Microsoft supported build engine• XML-based configuration file• Intellisense available from Visual Studio

using supplied schema• Ships with .NET Framework 2.0, it is NOT

part of Team Foundation Server• Both Visual Studio and Team Foundation

Server leverage MSBuild• Command-line utility - MSBuild.exe

Page 10: End To End Build Automation With Team Build

MSBuild Concepts

Page 11: End To End Build Automation With Team Build

MSBuild Concepts

• Projects– The root concept in MSBuild– Defines the build process

• Properties– Name/value pairs

• Items– Set of objects (commonly files)– Can specify meta-data to be applied to the

objects

Page 12: End To End Build Automation With Team Build

MSBuild Concepts

• Targets– Defines a number of sequential tasks– Projects can have initial and/or default

targets• Tasks

– Performs an operation– Uses properties and items– Extensible

Page 13: End To End Build Automation With Team Build

Examine a .vbproj File

• Demo• How does this work?

– Extends Microsoft.VisualBasic.targets– Which extends Microsoft.Common.targets

Page 14: End To End Build Automation With Team Build

Introduction to Team Build

• What is Team Build?– Service– Properties– Targets

Page 15: End To End Build Automation With Team Build

Introduction to Team Build

• What does Team Build do out-of-the-box?– Clean the build area– Retrieve latest version of source code– Label source code– Compile one or more solutions– Run code analysis and tests– Deploy binaries to a drop folder– Provide centralised logging and reporting

Page 16: End To End Build Automation With Team Build

Introduction to Team Build• Extends Microsoft.TeamFoundation.Build.targets• Supports customisation

– Configuration files– Customisable properties– Customisable targets

• Supports extensibility– Custom tasks– Team Foundation API– Build eventing

Page 17: End To End Build Automation With Team Build

Creating a Build Type

• Demo• Creates three files in Source Control

– TfsBuild.proj– TfsBuild.rsp– WorkspaceMapping.xml

• Best Practices– Avoid spaces in the name– Choose a long-term name

Page 18: End To End Build Automation With Team Build

Executing a Build

• Demo• From within Visual Studio• From the Command-Line (TfsBuild.exe)

– Also allows you to stop a build and delete builds

• From the API– Continuous Integration

Page 19: End To End Build Automation With Team Build

Default Build Process

• Generate build number• Clean• Get• Label• Compile• Create work items• Test• Drop

Page 20: End To End Build Automation With Team Build

Desktop Build Process

• Compile• Test

• No status report• Not part of build history• Launched from the command-line:

– MSBuild TfsBuild.proj /p:SolutionRoot=..\..

Page 21: End To End Build Automation With Team Build

Editing Build Types

• Directly edit the files in Source Control• Team Build will automatically get the

latest version for each build• Because these are stored in Source

Control we can reproduce any previous build, but make sure you keep your build dependencies in Source Control

Page 22: End To End Build Automation With Team Build

Editing Build Types

• Demo• Attrice Team Build Sidekick

Page 23: End To End Build Automation With Team Build

Build Process Customisation

• Each step in the build process provides customisation points– BeforeEndToEndIteration,

AfterEndToEndIteration– BuildNumberOverrideTarget– BeforeClean, AfterClean– BeforeGet, AfterGet– BeforeLabel, AfterLabel– BeforeCompile, AfterCompile

Page 24: End To End Build Automation With Team Build

Build Process Customisation

• Customisation points continued– BeforeTest, AfterTest– BeforeDropBuild, AfterDropBuild– BeforeOnBuildBroke, AfterOnBuildBroke

• You can override the other targets, but beware!

Page 25: End To End Build Automation With Team Build

Build Process Customisation

• Demo• Override build number• Get

– SkipGet– ForceGet– RecursiveGet– Partial get using WorkspaceMapping.xml

Page 26: End To End Build Automation With Team Build

Build Process Customisation

• Skip process step variables– SkipClean– SkipGet– SkipLabel– SkipInitializeWorkspace– SkipPostBuild– SkipDropBuild– SkipWorkItemCreation

Page 27: End To End Build Automation With Team Build

Build Process Customisation

• Location variables– WorkspaceName– SolutionRoot– BinariesRoot– TestResultsRoot

Page 28: End To End Build Automation With Team Build

Build Process Customisation

• Demo• Work Item Creation

– Change Assigned To

Page 29: End To End Build Automation With Team Build

Writing Custom Tasks

• Either implement Microsoft.Build.Framework.ITask

• Or, inherit Microsoft.Build.Utilities.Task• Provide Team System “awareness” by

passing $(TeamFoundationServerUrl) and $(BuildURI) as properties

• Avoid requiring Team System when not necessary

Page 30: End To End Build Automation With Team Build

Writing Custom Tasks

• XML attributes are passed through as properties

• Properties can be marked <Required()>• Properties can be marked <Output()>• Most intrinsic types are supported• Arrays of these types are also supported,

delimited using ; in XML• Use <UsingTask> to reference your custom

task

Page 31: End To End Build Automation With Team Build

Writing Custom Tasks

• Demo

Page 32: End To End Build Automation With Team Build

Resources

• My Bloghttp://blog.bartholomew.id.au/• MSDN Forums

http://forums.microsoft.com/forums/default.aspx?ForumGroupID=5

• OzTFS Mailing Listhttp://www.oztfs.com/

Page 33: End To End Build Automation With Team Build

Resources

• Attrice Team Build Sidekickhttp://www.attrice.info/cm/tfs/TeamBuildAddin.htm

• Team System Widgets http://accentient.com/widgets.aspx

Page 34: End To End Build Automation With Team Build

Thank you for attending

Don’t forget• Chuck and Marty’s session on “Best

Practices: Driving up quality using VSTS (Test & Build)” next Friday.

• Check out the Hands on Lab day on the www.vststechbrekkie.com site