Download presentation
Presentation is loading. Please wait.
1
TFS Build Extensions Joubin Najmaie Senior Consultant @TeamObjectSharp
TALMUG May 22, 2014
2
Agenda Life before Builds Build Server Components
Extending a Build Definition
3
Life Before Builds You hurry to check-in code at 5 PM
People are still working on the ‘last bug’ They get latest before checking in their own code Luckily, no conflicts However they try to compile the code – they get tons of errors. Run TFS annotate / blame to find out who checked in the bad code – it’s you They call you to see if you know what’s going, but you’re too busy having a beer while playing XBox You roll in at 10 AM the next morning Everyone’s pissed at you Your response – Dunno, IT WORKS ON MY MACHINE TFS Build server to the rescue
4
Build Components Build Server Build Controller Build Agents
Build Process Templates Build Definitions Builds
5
Build Server Team Foundation Server Visual Studio Online
A server that is running the Team Foundation Build Service If the only machine, will have the Controller If the only machine, will have the Agent Visual Studio Online Taken care of for you TFS: Runs the TF Build Server If only machine Controller Agents VSO: Taken care of for you
6
Build Controller Accepts build requests from TFS
It then gives the request to one of the agents i.e. manages a build agent pool Okay to install on the TFS server – not much overhead The Controller coordinates the builds for a Team Project Collection. Limitation: One controller per Team Project Collection It’s waiting on build requests from the Team Foundation Server It then hands off the build request based on some parameters to the build agents Since it has not much of an overhead, it’s okay to have it sit on the same server as TFS.
7
Build Agents Multiple Agents Managed by a single Controller
May be configured with dependencies e.g. Disk space, SQL Server etc. Not recommended on the Team Foundation Server There could be multiple agents to install/configure machines with various project dependencies To setup multiple agents, here are some factors to consider - How long does a build request sits in the queue - Look at the build reports - bill for an agent - cheap, $10/$30 per month - Licensing options Not recommended on the TFS Server Performance! A build may hang the machine making the server unavailable Demo! Setup Tags Working directory on the server Set the controller for it
8
Build Process Templates
a.k.a. Build Scripts OOTB build process templates a.k.a Build Scripts Demo! Show in VS OOTB Default Template – a basic process to build and test your code Upgrade – For backward compatibility with older build defs i.e. TFS 2008/5 AzureContinuous – to deploy Azure web sites and cloud services Lab – automate/extend deployments to the lab management Default templates Get Builds (GLV) Determines the drop location Initializes vars Create Labels Compiles projects Runs tests Associates changeset and work items Generates reports Copies files to the drop location
9
Build Definitions Follows the logic of a build process template
Supplies arguments to a build process template General Tab Name, Description Enabled Paused - allows for queueing builds, leaves the builds in a paused state Disabled – doesn’t allow users to queue builds Trigger Tab Manual: Set it if your build definition is still not ready to set to another trigger Or for other reasons – I’ve used it in client QA/UAT build prep Or a special process that you want to run only manually Queueing a private build – TFSBuild start command with the option of /shelveset Hot fixes CI On each check-in E.g. no drop folder to save space on server Rolling builds Similar to CI but used if you have a single build agent you have build agents that are not powerful You have a large team Gated Check-ins Similar to CI but more rigorous If build fails, it won’t introduce the checked-in code into your codebase Scheduled Daily builds You have the option of forced builds To trigger a build on certain days at an pre-determined time Daily builds: I had a client that setup a scheduled build definition to run for their daily builds Source Settings Working Folders Active: specifies the version-controlled folders that your build process requires Cloaked: Used for performance-optimization to exclude files that the build agent doesn’t require to build Is used for cases where you’re having customized builds that is segregating the builds into pieces.s Build Defaults If you’re dealing with Visual Studio Online, then there is always going to be a single controller i.e. Hosted Build Controller Staging Locations Don’t copy: used this for CI builds mostly Copy to a UNC path – have seen this to copy output to a Nuget Server Copy to source control folder Restriction: ‘Drops’ folder has to be the parent of the project folder Copy build output to server You can get the a zipped copy, by clicking on build outputs/report Click on Open Drop Location Click on “Download drop as zip” Process Configurations to build – Debug/Release Which Project to build Tagging/filtering of the agents Disable Tests - ? Create work item on failure Associate Changesets and work items Retention Policy Two sections: Triggered and manual: for normal builds i.e. non-shelvesets Private: for shelvesets Why have multiple definitions? Scenario: To store the output to server or no - CI builds Building to Nuget servers
10
Builds Manual, Triggered, Scheduled Queue a new build
Tab: Parameters May want to use this for manually triggered builds. Tab: General Build qualities
11
Extending Build Definitions
Simple Case – with no assembly dependency A slightly more complex case – with assembly dependency
12
Custom Build – Hello World
Demo Add a WriteBuildMessage to the default template Create a build definition of this kind Queue a build View logs for the build
13
Custom Build – Slightly more Complex
SQL Server Data Tools SSMS + VS Version Controlling your database deployment scripts It allows for seeding – in dev environments DAC – data-tier application DACPAC – DAC Package Hand off to db admins for deployment SQL db compares SSDT The marriage of SSMS and Visual Studio packages all into one + extras Manages and version control your Scripts/Databases Provides full-featured script editing - Object Explorer etc. Helps with deployment of the schema changes DAC DAC - Package Easy for database admins as it generates the Dac and handed over to the database admins Build and Publish DacPac Ability to compare the DacPac against the target database Builds appropriate change script Provides the easy ability to rollback and roll-forward to any version It allows for Creating 'Insert' scripts - for dev environmnets ? Ability to define a post deployment script as well
14
Why? DacVersion Signifance
Synchronizing Assembly Version with DacVersion Easy trackability and administration Demo! Unload SQL Data Project Edit proj file
15
Community TFS Build Extensions
Community TFS Build Extensions .NET Code Kindler
16
Custom Build – DacVersion Sync’ing
Demo Demo! Attr – BuildActivity Subclass – BaseCodeActivity Open XAML file Show/Drop the activity Upload activity to buildprocesstemplates folder Check in Queue a new build Download build.dacpac Look inside for build format number
17
Resources Have issues with VSO – use Twitter
@tfservice @visualstudio @tfsbuck Slides and Project Code will be available on joubin.net TALMUG site
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.