End To End Build Automation With Team Build

3,758 views

Published on

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,758
On SlideShare
0
From Embeds
0
Number of Embeds
134
Actions
Shares
0
Downloads
152
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

End To End Build Automation With Team Build

  1. 1. “ Welcome”
  2. 2. 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
  3. 3. VSTSTechBrekkie <ul><li>Final session coming up </li></ul><ul><ul><li>27th Oct 2006 - &quot; Best Practices: Driving up quality using VSTS (Test & Build) “ with Chuck & Marty </li></ul></ul>
  4. 4. VSTSTechBrekkie <ul><li>Hands on Lab day </li></ul><ul><ul><li>Friday 10 th November 2006 </li></ul></ul><ul><ul><li>Free registration open for either of the following sessions; </li></ul></ul><ul><ul><ul><li>Morning 9:00 – 12:30 - or - </li></ul></ul></ul><ul><ul><ul><li>Afternoon 1:00 – 4:30 </li></ul></ul></ul>Supported by
  5. 5. QLD VSTS Users Group <ul><li>Please complete registration form provided if you wish to register for the user group </li></ul><ul><li>Current plan is for a Friday morning Breakfast event on 1 st Friday of each month </li></ul><ul><li>Inaugural meeting Friday 1 st December 06 </li></ul><ul><li>Website due in the next week or two </li></ul>www.qvstsug.org
  6. 6. “ End to end build automation using Team Build” William Bartholomew Developer Productivity Specialist, TechnologyOne
  7. 7. Who Am I? <ul><li>Developer Productivity Specialist TechnologyOne, Brisbane </li></ul><ul><li>Technical Reviewer of Code Complete 2 nd Edition by Steve McConnell </li></ul><ul><li>Technical Reviewer of .NET Standard Library Annotated Reference Volume 2 by Brad and Tamara Abrams </li></ul><ul><li>Member of Microsoft UI Frameworks Advisory Council (ASP .NET and Smart Client) </li></ul><ul><li>MSDN Forum Moderator </li></ul>
  8. 8. Agenda <ul><li>Introduction to MSBuild </li></ul><ul><li>Introduction to Team Build </li></ul><ul><li>Creating a Build Type </li></ul><ul><li>Executing a Build </li></ul><ul><li>Default Process </li></ul><ul><li>Editing Build Types </li></ul><ul><li>Build Process Customisation </li></ul><ul><li>Writing Custom Tasks </li></ul><ul><li>Resources </li></ul>
  9. 9. Introduction to MSBuild <ul><li>Microsoft supported build engine </li></ul><ul><li>XML-based configuration file </li></ul><ul><li>Intellisense available from Visual Studio using supplied schema </li></ul><ul><li>Ships with .NET Framework 2.0, it is NOT part of Team Foundation Server </li></ul><ul><li>Both Visual Studio and Team Foundation Server leverage MSBuild </li></ul><ul><li>Command-line utility - MSBuild.exe </li></ul>
  10. 10. MSBuild Concepts
  11. 11. MSBuild Concepts <ul><li>Projects </li></ul><ul><ul><li>The root concept in MSBuild </li></ul></ul><ul><ul><li>Defines the build process </li></ul></ul><ul><li>Properties </li></ul><ul><ul><li>Name/value pairs </li></ul></ul><ul><li>Items </li></ul><ul><ul><li>Set of objects (commonly files) </li></ul></ul><ul><ul><li>Can specify meta-data to be applied to the objects </li></ul></ul>
  12. 12. MSBuild Concepts <ul><li>Targets </li></ul><ul><ul><li>Defines a number of sequential tasks </li></ul></ul><ul><ul><li>Projects can have initial and/or default targets </li></ul></ul><ul><li>Tasks </li></ul><ul><ul><li>Performs an operation </li></ul></ul><ul><ul><li>Uses properties and items </li></ul></ul><ul><ul><li>Extensible </li></ul></ul>
  13. 13. Examine a .vbproj File <ul><li>Demo </li></ul><ul><li>How does this work? </li></ul><ul><ul><li>Extends Microsoft.VisualBasic.targets </li></ul></ul><ul><ul><li>Which extends Microsoft.Common.targets </li></ul></ul>
  14. 14. Introduction to Team Build <ul><li>What is Team Build? </li></ul><ul><ul><li>Service </li></ul></ul><ul><ul><li>Properties </li></ul></ul><ul><ul><li>Targets </li></ul></ul>
  15. 15. Introduction to Team Build <ul><li>What does Team Build do out-of-the-box? </li></ul><ul><ul><li>Clean the build area </li></ul></ul><ul><ul><li>Retrieve latest version of source code </li></ul></ul><ul><ul><li>Label source code </li></ul></ul><ul><ul><li>Compile one or more solutions </li></ul></ul><ul><ul><li>Run code analysis and tests </li></ul></ul><ul><ul><li>Deploy binaries to a drop folder </li></ul></ul><ul><ul><li>Provide centralised logging and reporting </li></ul></ul>
  16. 16. Introduction to Team Build <ul><li>Extends Microsoft.TeamFoundation.Build.targets </li></ul><ul><li>Supports customisation </li></ul><ul><ul><li>Configuration files </li></ul></ul><ul><ul><li>Customisable properties </li></ul></ul><ul><ul><li>Customisable targets </li></ul></ul><ul><li>Supports extensibility </li></ul><ul><ul><li>Custom tasks </li></ul></ul><ul><ul><li>Team Foundation API </li></ul></ul><ul><ul><li>Build eventing </li></ul></ul>
  17. 17. Creating a Build Type <ul><li>Demo </li></ul><ul><li>Creates three files in Source Control </li></ul><ul><ul><li>TfsBuild.proj </li></ul></ul><ul><ul><li>TfsBuild.rsp </li></ul></ul><ul><ul><li>WorkspaceMapping.xml </li></ul></ul><ul><li>Best Practices </li></ul><ul><ul><li>Avoid spaces in the name </li></ul></ul><ul><ul><li>Choose a long-term name </li></ul></ul>
  18. 18. Executing a Build <ul><li>Demo </li></ul><ul><li>From within Visual Studio </li></ul><ul><li>From the Command-Line (TfsBuild.exe) </li></ul><ul><ul><li>Also allows you to stop a build and delete builds </li></ul></ul><ul><li>From the API </li></ul><ul><ul><li>Continuous Integration </li></ul></ul>
  19. 19. Default Build Process <ul><li>Generate build number </li></ul><ul><li>Clean </li></ul><ul><li>Get </li></ul><ul><li>Label </li></ul><ul><li>Compile </li></ul><ul><li>Create work items </li></ul><ul><li>Test </li></ul><ul><li>Drop </li></ul>
  20. 20. Desktop Build Process <ul><li>Compile </li></ul><ul><li>Test </li></ul><ul><li>No status report </li></ul><ul><li>Not part of build history </li></ul><ul><li>Launched from the command-line: </li></ul><ul><ul><li>MSBuild TfsBuild.proj /p:SolutionRoot=.... </li></ul></ul>
  21. 21. Editing Build Types <ul><li>Directly edit the files in Source Control </li></ul><ul><li>Team Build will automatically get the latest version for each build </li></ul><ul><li>Because these are stored in Source Control we can reproduce any previous build, but make sure you keep your build dependencies in Source Control </li></ul>
  22. 22. Editing Build Types <ul><li>Demo </li></ul><ul><li>Attrice Team Build Sidekick </li></ul>
  23. 23. Build Process Customisation <ul><li>Each step in the build process provides customisation points </li></ul><ul><ul><li>BeforeEndToEndIteration, AfterEndToEndIteration </li></ul></ul><ul><ul><li>BuildNumberOverrideTarget </li></ul></ul><ul><ul><li>BeforeClean, AfterClean </li></ul></ul><ul><ul><li>BeforeGet, AfterGet </li></ul></ul><ul><ul><li>BeforeLabel, AfterLabel </li></ul></ul><ul><ul><li>BeforeCompile, AfterCompile </li></ul></ul>
  24. 24. Build Process Customisation <ul><li>Customisation points continued </li></ul><ul><ul><li>BeforeTest, AfterTest </li></ul></ul><ul><ul><li>BeforeDropBuild, AfterDropBuild </li></ul></ul><ul><ul><li>BeforeOnBuildBroke, AfterOnBuildBroke </li></ul></ul><ul><li>You can override the other targets, but beware! </li></ul>
  25. 25. Build Process Customisation <ul><li>Demo </li></ul><ul><li>Override build number </li></ul><ul><li>Get </li></ul><ul><ul><li>SkipGet </li></ul></ul><ul><ul><li>ForceGet </li></ul></ul><ul><ul><li>RecursiveGet </li></ul></ul><ul><ul><li>Partial get using WorkspaceMapping.xml </li></ul></ul>
  26. 26. Build Process Customisation <ul><li>Skip process step variables </li></ul><ul><ul><li>SkipClean </li></ul></ul><ul><ul><li>SkipGet </li></ul></ul><ul><ul><li>SkipLabel </li></ul></ul><ul><ul><li>SkipInitializeWorkspace </li></ul></ul><ul><ul><li>SkipPostBuild </li></ul></ul><ul><ul><li>SkipDropBuild </li></ul></ul><ul><ul><li>SkipWorkItemCreation </li></ul></ul>
  27. 27. Build Process Customisation <ul><li>Location variables </li></ul><ul><ul><li>WorkspaceName </li></ul></ul><ul><ul><li>SolutionRoot </li></ul></ul><ul><ul><li>BinariesRoot </li></ul></ul><ul><ul><li>TestResultsRoot </li></ul></ul>
  28. 28. Build Process Customisation <ul><li>Demo </li></ul><ul><li>Work Item Creation </li></ul><ul><ul><li>Change Assigned To </li></ul></ul>
  29. 29. Writing Custom Tasks <ul><li>Either implement Microsoft.Build.Framework.ITask </li></ul><ul><li>Or, inherit Microsoft.Build.Utilities.Task </li></ul><ul><li>Provide Team System “awareness” by passing $(TeamFoundationServerUrl) and $(BuildURI) as properties </li></ul><ul><li>Avoid requiring Team System when not necessary </li></ul>
  30. 30. Writing Custom Tasks <ul><li>XML attributes are passed through as properties </li></ul><ul><li>Properties can be marked <Required()> </li></ul><ul><li>Properties can be marked <Output()> </li></ul><ul><li>Most intrinsic types are supported </li></ul><ul><li>Arrays of these types are also supported, delimited using ; in XML </li></ul><ul><li>Use <UsingTask> to reference your custom task </li></ul>
  31. 31. Writing Custom Tasks <ul><li>Demo </li></ul>
  32. 32. Resources <ul><li>My Blog http://blog.bartholomew.id.au/ </li></ul><ul><li>MSDN Forums http://forums.microsoft.com/forums/default.aspx?ForumGroupID=5 </li></ul><ul><li>OzTFS Mailing List http://www.oztfs.com/ </li></ul>
  33. 33. Resources <ul><li>Attrice Team Build Sidekick http://www.attrice.info/cm/tfs/TeamBuildAddin.htm </li></ul><ul><li>Team System Widgets http://accentient.com/widgets.aspx </li></ul>
  34. 34. Thank you for attending <ul><li>Don’t forget </li></ul><ul><li>Chuck and Marty’s session on “Best Practices: Driving up quality using VSTS (Test & Build)” next Friday. </li></ul><ul><li>Check out the Hands on Lab day on the www.vststechbrekkie.com site </li></ul>

×