Team Build Tips and Tricks Chris Menegay VP


Team Build Tips and Tricks Chris Menegay VP of Consulting Notion Solutions Session Code: DTL 306

Agenda Real quick review of MSBuild What does Team Build do by default? What if I don’t like that? !? But, I want to do more!

What is MSBuild? A fully extensible build system that ships with the. NET Framework 2. 0+. A build system that is seamlessly integrated with Visual Studio 2005/2008/2010. Uses an XML file for describing your project’s properties, items, and build process.

What does it take to compile code? PSEUDOCODE // Setup a name for an output file Output. File. Name = “My. App. exe” // what files we need to compile Files. To. Compile[0] = “Form 1. cs” Files. To. Compile[1] = “Program. cs” // Create a routine called “Build” that does work Method Build() // emit a message with some method “Message” Message(“Compiling My. App. exe”) // need a method called CSC that does the compile CSC(Files. To. Compile, Output. File. Name) End Method Build

Declaring Variables PSEUDOCODE // Setup a name for an output file Output. File. Name = “My. App. exe” Becomes the following MSBUILD code: <Property. Group> <Output. File. Name>My. App. exe</Output. File. Name> </Property. Group>
![Declaring Collections PSEUDOCODE // what files we need to compile Files. To. Compile[0] = Declaring Collections PSEUDOCODE // what files we need to compile Files. To. Compile[0] =](http://slidetodoc.com/presentation_image_h2/c252c412728219048fe91785567ac869/image-7.jpg)
Declaring Collections PSEUDOCODE // what files we need to compile Files. To. Compile[0] = “Form 1. cs” Files. To. Compile[1] = “Program. cs” Becomes the following MSBUILD code: <Item. Group> <Files. To. Compile Include=“Form 1. cs” /> <Files. To. Compile Include=“Program. cs” /> </Item. Group>

Building a Subroutine // Create a routine called “Build” that does the work Method Build() // emit a message with some method “Message” Message(“Compiling “ + Output. File. Name) // need a method called CSC that does the compile CSC(Files. To. Compile, Output. File. Name) End Method Build Becomes the following MSBUILD code: <Target Name=“Build”> <Message Text=“Compiling $(Output. File. Name)” /> <Csc Sources=“@(Files. To. Compile)” Output. Assembly=“$(Output. File. Name)”/> </Target>

The Result! <Project xmlns=“http: //schemas. microsoft. com/developer/msbuild/2003”> <Property. Group> <Output. File. Name>My. App. exe</Output. File. Name> </Property. Group> <Item. Group> <Files. To. Compile Include=“Form 1. cs” /> <Files. To. Compile Include=“Program. cs” /> </Item. Group> <Target Name=“Build”> <Message Text=“Compiling $(Output. File. Name)” /> <Csc Sources=“@(Files. To. Compile)” Output. Assembly=“$(Output. File. Name)”/> </Target> </Project>

MSBuild Project File Structure <Project xmlns=“http: //schemas. microsoft. com/developer/msbuild/2003” > <Property. Group> <Output. File. Name>My. App. exe</Output. File. Name> </Property. Group> <Item. Group> <Files. To. Compile Include=“Form 1. cs” /> <Files. To. Compile Include=“Program. cs” /> </Item. Group> <Target Name=“Build”> <Message Text=“Compiling $(Output. File. Name)” /> <Csc Sources=“@(Files. To. Compile)” Output. Assembly=“$(Output. File. Name)”/> </Target> </Project>

What about Team Build? Build initiated from TFS Prepare build machine & Generate a Build. Name Get sources Compile and analyze Execute tests Calculate code coverage Update work items Calculate code churn Produce build details Publish build

Create. Workspace Consumed by vcbuild Get. Source VCOverrides. vsprops Command line overrides for msbuild TFSBuild. rsp s ive r D MSBuild Generated by Team Foundation Build Wizard Anatomy Of A Team Foundation Build Script TFSBuild. proj Includes Yours. targets MS. TF. Build. targets Label. Source Test. Tools. Task Gen. Checkin. Notes Update. Work. Items Create. New. Work. Item Delete. Workspace • Compiles a list of all • Creates version checkinsanew in this control workspace for build the build • • Populates Compiles aworkspace list of all • Uses settings from with the latest copy of work items associated workspacemapping. xml source with those checkins • Tags revisions of built with a label • files Updates work items with “build • Label nameavailable” matches ID Executes build number • • Creates a automated bug when tests on the • Deletes server-state for the build failsbuild outputs the build workspace • Leaves Publishes results to on built sources TFS machine build • Leverages VSTS test tools for distributed tests capabilities

Agenda Real quick review of MSBuild What does Team Build do by default? What if I don’t like that? !? But, I want to do more!

demo Extending Team Build

Resources Tech·Ed Africa 2009 sessions will be made available for download the week after the event from: www. tech-ed. co. za www. microsoft. com/teched www. microsoft. com/learning International Content & Community Microsoft Certification & Training Resources http: //microsoft. com/technet http: //microsoft. com/msdn Resources for IT Professionals Resources for Developers

VSTS/SDLC Sessions at Teched Time Code Title Monday 9: 15 DTL 203 What’s New in Team Foundation Server 2010? Monday 10: 45 DTL 305 Managing Releases Between Your Development and QA with Team System 2008 Monday 13: 15 DTL 201 Improve Application Quality with Microsoft Visual Studio Team System 2010 Team Test Monday 13: 15 OFC 309 Capacity Planning for Share. Point Server 2007 using Visual Studio 2008 Team Test Monday 15: 45 DPR 201 The Daily Scrum Monday 17: 15 DTL 301 Power Tools on Team Foundation Server 2008 Tues 8: 00 DTL 205 A Lap Around Team System 2010 Architecture Edition Tues 9: 15 DTL 306 Team Build Tips and Tricks Tues 12: 00 DTL 313 Using Virtualization to Improve Application Quality with Team System Lab Management Tues 13: 15 DTL 210 Managing Requirements with Team Foundation Server 2010 Tues 14: 30 WTB 212 How Microsoft and Others Use Team Foundation Server (whiteboard) Tues 16: 15 DTL 202 Team System 2010 Development Essentials Tues 16: 15 ARC 203 Application Lifecycle Maturity Wed 10: 15 DTL 303 Practical Web Testing

10 pairs of MP 3 sunglasses to be won Complete a session evaluation and enter to win!

question & answer

© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U. S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
- Slides: 19