Upload
wbarthol
View
5.870
Download
1
Embed Size (px)
DESCRIPTION
Citation preview
“Welcome”
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
VSTSTechBrekkie
• Final session coming up– 27th Oct 2006 - "Best Practices: Driving
up quality using VSTS (Test & Build)“ with Chuck & Marty
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
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
“End to end build automation using Team Build”
William BartholomewDeveloper Productivity Specialist, TechnologyOne
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
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
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
MSBuild Concepts
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
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
Examine a .vbproj File
• Demo• How does this work?
– Extends Microsoft.VisualBasic.targets– Which extends Microsoft.Common.targets
Introduction to Team Build
• What is Team Build?– Service– Properties– Targets
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
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
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
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
Default Build Process
• Generate build number• Clean• Get• Label• Compile• Create work items• Test• Drop
Desktop Build Process
• Compile• Test
• No status report• Not part of build history• Launched from the command-line:
– MSBuild TfsBuild.proj /p:SolutionRoot=..\..
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
Editing Build Types
• Demo• Attrice Team Build Sidekick
Build Process Customisation
• Each step in the build process provides customisation points– BeforeEndToEndIteration,
AfterEndToEndIteration– BuildNumberOverrideTarget– BeforeClean, AfterClean– BeforeGet, AfterGet– BeforeLabel, AfterLabel– BeforeCompile, AfterCompile
Build Process Customisation
• Customisation points continued– BeforeTest, AfterTest– BeforeDropBuild, AfterDropBuild– BeforeOnBuildBroke, AfterOnBuildBroke
• You can override the other targets, but beware!
Build Process Customisation
• Demo• Override build number• Get
– SkipGet– ForceGet– RecursiveGet– Partial get using WorkspaceMapping.xml
Build Process Customisation
• Skip process step variables– SkipClean– SkipGet– SkipLabel– SkipInitializeWorkspace– SkipPostBuild– SkipDropBuild– SkipWorkItemCreation
Build Process Customisation
• Location variables– WorkspaceName– SolutionRoot– BinariesRoot– TestResultsRoot
Build Process Customisation
• Demo• Work Item Creation
– Change Assigned To
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
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
Writing Custom Tasks
• Demo
Resources
• My Bloghttp://blog.bartholomew.id.au/• MSDN Forums
http://forums.microsoft.com/forums/default.aspx?ForumGroupID=5
• OzTFS Mailing Listhttp://www.oztfs.com/
Resources
• Attrice Team Build Sidekickhttp://www.attrice.info/cm/tfs/TeamBuildAddin.htm
• Team System Widgets http://accentient.com/widgets.aspx
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