11/21/2018 4:27 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.
Team Build Tips and Tricks Tech·Ed North America 2009 11/21/2018 4:27 PM Team Build Tips and Tricks Getting Team Build setup to compile your code is straightforward for .NET projects, but where do you go from there? In this session, we’ll cover performance and management tips for Team Build. We will step through what Team Build does during the build process and uncover the areas where you can extend, remove and replace the default functionality. Also explored will be topics such as non-.NET compilations, deployment and general extensibility. This session will have ample time for interaction and Q&A – so bring your questions! Chris Menegay VP of Consulting Notion Solutions Session Code: DTL306 © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.
Agenda Real quick review of MSBuild 11/21/2018 4:27 PM 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! © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.
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. This presentation is for informational purposes only. Notion Solutions makes no warranties, express or implied. Copyright © 2006 Notion Solutions, Inc.. All rights reserved.
What does it take to compile code? PSEUDOCODE // Setup a name for an output file OutputFileName = “MyApp.exe” // what files we need to compile FilesToCompile[0] = “Form1.cs” FilesToCompile[1] = “Program.cs” // Create a routine called “Build” that does work Method Build() // emit a message with some method “Message” Message(“Compiling MyApp.exe”) // need a method called CSC that does the compile CSC(FilesToCompile, OutputFileName) End Method Build
Declaring Variables PSEUDOCODE Becomes the following MSBUILD code: // Setup a name for an output file OutputFileName = “MyApp.exe” Becomes the following MSBUILD code: <PropertyGroup> <OutputFileName>MyApp.exe</OutputFileName> </PropertyGroup> Properties are basically name-value pairs. Microsoft.Build.xsd schema (which is essentially Microsoft.Build.CommonTypes.xsd + Microsoft.Build.Core.xsd) does not allow arbitrary named properties, that is intentional, because it will catch typoes in property names. You have to extend the schema with any custom properties if you want to use it for validation. If you want to only use it for intellisense in the VS XML editor, you don't need to extend it -- you can just ignore the squiggles and use the intellisense. Environment Variables can be accessed just like Properties but cannot be set from an MSBuild script More about the MSBuild file structure on the next slide
Declaring Collections PSEUDOCODE // what files we need to compile FilesToCompile[0] = “Form1.cs” FilesToCompile[1] = “Program.cs” Becomes the following MSBUILD code: <ItemGroup> <FilesToCompile Include=“Form1.cs” /> <FilesToCompile Include=“Program.cs” /> </ItemGroup>
Building a Subroutine Becomes the following MSBUILD code: // Create a routine called “Build” that does the work Method Build() // emit a message with some method “Message” Message(“Compiling “ + OutputFileName) // need a method called CSC that does the compile CSC(FilesToCompile, OutputFileName) End Method Build Becomes the following MSBUILD code: <Target Name=“Build”> <Message Text=“Compiling $(OutputFileName)” /> <Csc Sources=“@(FilesToCompile)” OutputAssembly=“$(OutputFileName)”/> </Target>
The Result! <Project xmlns=“http://schemas.microsoft.com/developer/msbuild/2003”> <PropertyGroup> <OutputFileName>MyApp.exe</OutputFileName> </PropertyGroup> <ItemGroup> <FilesToCompile Include=“Form1.cs” /> <FilesToCompile Include=“Program.cs” /> </ItemGroup> <Target Name=“Build”> <Message Text=“Compiling $(OutputFileName)” /> <Csc Sources=“@(FilesToCompile)” OutputAssembly=“$(OutputFileName)”/> </Target> </Project>
MSBuild Project File Structure <Project xmlns=“http://schemas.microsoft.com/developer/msbuild/2003”> <PropertyGroup> <OutputFileName>MyApp.exe</OutputFileName> </PropertyGroup> <ItemGroup> <FilesToCompile Include=“Form1.cs” /> <FilesToCompile Include=“Program.cs” /> </ItemGroup> <Target Name=“Build”> <Message Text=“Compiling $(OutputFileName)” /> <Csc Sources=“@(FilesToCompile)” OutputAssembly=“$(OutputFileName)”/> </Target> </Project> Properties Items Targets Tasks This presentation is for informational purposes only. Notion Solutions makes no warranties, express or implied. Copyright © 2006 Notion Solutions, Inc.. All rights reserved.
What about Team Build? Build initiated from TFS Prepare build machine & Generate a BuildName Get sources Compile and analyze Execute tests Calculate code coverage Update work items Calculate code churn Produce build details Publish build This presentation is for informational purposes only. Notion Solutions makes no warranties, express or implied. Copyright © 2006 Notion Solutions, Inc.. All rights reserved.
Anatomy Of A Team Foundation Build Script Generated by Team Foundation Build Wizard CreateWorkspace Consumed by vcbuild VCOverrides.vsprops Creates a version control workspace for the build Uses settings from workspacemapping.xml Compiles a list of all checkins new in this build Compiles a list of all work items associated with those checkins Updates work items with “build available” ID GetSource Populates workspace with the latest copy of source Command line overrides for msbuild TFSBuild.rsp LabelSource Tags revisions of built files with a label Label name matches build number MSBuild TestToolsTask Executes automated tests on the build outputs Publishes results to TFS Leverages VSTS test tools for distributed tests capabilities TFSBuild.proj Creates a bug when the build fails Deletes server-state for the build workspace Leaves built sources on build machine Drives GenCheckinNotes UpdateWorkItems Includes CreateNewWorkItem Yours.targets MS.TF.Build.targets DeleteWorkspace This presentation is for informational purposes only. Notion Solutions makes no warranties, express or implied. Copyright © 2006 Notion Solutions, Inc.. All rights reserved.
Agenda Real quick review of MSBuild 11/21/2018 4:27 PM 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! © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.
demo Extending Team Build 11/21/2018 4:27 PM If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide. Extending Team Build © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.
Resources Required Slide Speakers, www.microsoft.com/teched TechEd 2009 is not producing a DVD. Please announce that attendees can access session recordings from Tech-Ed website. These will only be available after the event. 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 International Content & Community www.microsoft.com/learning Microsoft Certification & Training Resources http://microsoft.com/technet Resources for IT Professionals http://microsoft.com/msdn Resources for Developers
VSTS/SDLC Sessions at Teched Time Code Title Monday 9:15 DTL203 What’s New in Team Foundation Server 2010? Monday 10:45 DTL305 Managing Releases Between Your Development and QA with Team System 2008 Monday 13:15 DTL201 Improve Application Quality with Microsoft Visual Studio Team System 2010 Team Test OFC309 Capacity Planning for SharePoint Server 2007 using Visual Studio 2008 Team Test Monday 15:45 DPR201 The Daily Scrum Monday 17:15 DTL301 Power Tools on Team Foundation Server 2008 Tues 8:00 DTL205 A Lap Around Team System 2010 Architecture Edition Tues 9:15 DTL306 Team Build Tips and Tricks Tues 12:00 DTL313 Using Virtualization to Improve Application Quality with Team System Lab Management Tues 13:15 DTL210 Managing Requirements with Team Foundation Server 2010 Tues 14:30 WTB212 How Microsoft and Others Use Team Foundation Server (whiteboard) Tues 16:15 DTL202 Team System 2010 Development Essentials ARC203 Application Lifecycle Maturity Wed 10:15 DTL303 Practical Web Testing
10 pairs of MP3 sunglasses to be won Required Slide 10 pairs of MP3 sunglasses to be won Complete a session evaluation and enter to win!
question & answer
Required Slide 11/21/2018 4:27 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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. © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.