SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Team Foundation Server
   Build Automation

      Give me a Light, Build Light
            Mike Douglas
      mike@doitconsultants.com
     www.CodeSmartNotHard.com
    www.CodePlex.com/TeamDeploy
About Me
• Current Lead Developer / Analyst at Farm Credit
  Services of America
• Wide variety background in .NET
  – Web Services, Remoting, WCF, WinForms, ASP.NET,
    Biztalk, TFS, CSLA.NET, Code Generation
• Frameworks, Code Generation, and Agile Blog
  – www.CodeSmartNotHard.com
• Open Source Project for TFS Builds
  – www.CodePlex.com/TeamDeploy
• 3rd .NET User Group Presentation
Agenda
•   Build Automation – more than just build
•   Creating a build
•   What’s in a build – Proj, Targets, and Tasks
•   Creating a Custom Task
•   Team Deploy
Build Automation
• Should be part of a good configuration
  management process
• Our Goal – Deploy same MSI to test as
  production
  – Separate Environments
     • Development, Test, Staging, Production
  – Continuous and “Build and Deploy” Builds
  – Admin Install MSIs
  – ConfigFiles folder for multiple environments
ConfigFiles folder
Creating a Build
• Demo
What is in a build?
• TFSBuild.proj – XML for TeamBuild
• Targets – “Events” of the build, Before/After
  are overrideable for custom functionality.
• Tasks – built in or custom actions that perform
  a set piece of functionality.

Quick Demo
Build Targets
End to End Iteration

         Clean


      Get Source
                                     Build Break
                       Build Error
         Label


        Compile


       Run Tests


    Drop Build Files
Targets
• Commonly used ones
 Target Name               Description
 BeforeEndtoEndIteration   Runs tasks before EndToEndIteration target. Use this
                           to run something before the build starts.
                           Example: Turn street light yellow.
 AfterEndtoEndIteration    Runs tasks after EndToEndIteration target. Use this to
                           run something after the build successfully completes.
                           Example: Copy Binaries and Config Files to MSI,
                           Deploy MSI, Turn on Green Street Light
 BeforeTest                Called before tests are run.
                           Example: Update or Prepare database or spreadsheet
                           for Unit Tests
 AfterOnBuildBreak         Called after a work item is created when a build fails
                           Example: Turn on Red Street Light
Other Overridable Targets
Target Name                 Description
BuildNumberOverrideTarget   Used to override a target to customize a build number. The task you write must
                            create an ouptut property called BuildNumber
BeforeClean                 Called before clean is tried. Insert your task into this target to run pre-clean
                            custom target.
AfterClean                  Called after clean is completed.

BeforeGet                   Called before sources are retrieved from source control

AfterGet                    Called after sources are retrieved

BeforeLabel                 Called before sources are labeled.

AfterLabel                  Called after labeling is completed.

BeforeCompile               Called before compilation is completed.

AfterCompile                Called after compilation is completed.

AfterTest                   Called after testing is completed.

BeforeDropBuild             Called before saving the built binaries, build log files and test results to the build-
                            drop directory.
AfterDropBuild              Called after dropping the built binaries, build log files and test results to the
                            build-drop directory.
BeforeOnBuildBreak          Called before creating a work item on the build that fails
Tasks
• Built in tasks
   – About 45 built in tasks
   – Complete List
     http://msdn.microsoft.com/en-us/library/7z253716.aspx

• Custom tasks projects
   – SDC (over 300 tasks!)
     http://www.codeplex.com/sdctasks
   – Community Tasks (about 50 tasks)
     http://msbuildtasks.tigris.org/
   – Team Deploy (Dedicated to Deployments)
     http://www.codeplex.com/teamdeploy
Creating a custom task
• Microsoft.Build.Framework.ITask
• Microsoft.Build.Utilities.Task base class
     public override bool Execute()
         {
            DoSomething();

             return true;
         }
Creating a custom task (cont)
• Unit Tests – BuildEngine
[TestMethod]
    public void KillProcessExecute()
    {

        Process.Start(quot;notepad.exequot;);
        KillProcess task = new KillProcess();

        task.BuildEngine = new MockBuild();
        task.ProcessName = quot;notepad.exequot;;
        task.KillAppPathFilename = quot;c:pstoolspskill.exequot;;
        task.TargetMachine = Environment.MachineName;

        Assert.IsTrue(task.Execute(), quot;Execute Failedquot;);

    }
Create a custom task
• Demo
Team Deploy
• Today is the launch of 1.0.0!
• 273 Downloads!
• Set of Custom Tasks
  – Deploying MSIs
  – Controlling Devices like Lava Lamps and Street
    Lights
• DeviceController Application
• Guidance Document
Team Deploy Features
• Parallel MSI Deployments
• Unit Tests
• Code Analysis = Green
• No unknown programs need to run on target
  machines
• Utilizes strength and trust of PS Tools.
Team Deploy Architecture
Team Deploy Tasks
Task Name          Description
Install            Installs a MSI to a target machine
Uninstall          Uninstalls MSI on target machine by product code
KillProcess        Kills a process on a target machine
StartService       Starts are windows service
StopService        Stops a windows service (usually before uninstalling)
DeviceController   Use lava lamps or street lights to display status of builds
Deploy             Primary Task – Reads Deployment Script. The script contains the
                   list of target machines, MSIs to install, any kill processes, and
                   uninstalls.
Device Controller
• Calls the x10Communicator.exe (part of Team
  Deploy) to turn on and off devices
• StartTime and StopTime so device doesn’t
  turn on at night
• Device state is stored in Isolated Storage
• Start and Shutdown arguments to turn all
  devices either on or off.
Device Controller Parts
• X10 Firecracker
Team Deploy Demo
• Street Light Demo
Links
•   X10 Firecracker
•   SysInternals PSExec
•   http://www.CodePlex.com/TeamDeploy
•   http://www.CodeSmartNotHard.com
•   http://www.tfsbuild.com

Weitere ähnliche Inhalte

Andere mochten auch

TFS Build - Continuous Integration
TFS Build - Continuous IntegrationTFS Build - Continuous Integration
TFS Build - Continuous IntegrationEsteban Garcia
 
[Curitiba DEV DAY] - Novidades do TFS 2015
[Curitiba DEV DAY] -  Novidades do TFS 2015[Curitiba DEV DAY] -  Novidades do TFS 2015
[Curitiba DEV DAY] - Novidades do TFS 2015Leandro Prado
 
Introduction to Team Foundation Server (TFS) Online
Introduction to Team Foundation Server (TFS) OnlineIntroduction to Team Foundation Server (TFS) Online
Introduction to Team Foundation Server (TFS) OnlineDenis Voituron
 
Power shell desired state configuration for Devops and ALM practitioners
Power shell desired state configuration for Devops and ALM practitionersPower shell desired state configuration for Devops and ALM practitioners
Power shell desired state configuration for Devops and ALM practitionersWilly Marroquin (WillyDevNET)
 
Integrated Proposal (Vsts Sps Tfs) - MS stack
Integrated Proposal   (Vsts Sps Tfs) - MS stackIntegrated Proposal   (Vsts Sps Tfs) - MS stack
Integrated Proposal (Vsts Sps Tfs) - MS stackBijoy Viswanadhan
 
What's new in ALM using Visual Studio 2013 and TFS 2013
What's new in ALM using Visual Studio 2013 and TFS 2013What's new in ALM using Visual Studio 2013 and TFS 2013
What's new in ALM using Visual Studio 2013 and TFS 2013Microsoft Visual Studio
 
Alm with tfs 2013
Alm with tfs 2013Alm with tfs 2013
Alm with tfs 2013MSDEVMTL
 
TFS 2015 Upgrade Tips & Tricks
TFS 2015 Upgrade Tips & TricksTFS 2015 Upgrade Tips & Tricks
TFS 2015 Upgrade Tips & TricksInCycleSoftware
 
Visual Studio Code 拡張の勘所
Visual Studio Code 拡張の勘所Visual Studio Code 拡張の勘所
Visual Studio Code 拡張の勘所Masaki Takeda
 
Install, configure and customize TFS 2013
Install, configure and customize TFS 2013Install, configure and customize TFS 2013
Install, configure and customize TFS 2013Davide Benvegnù
 
Release management with TFS 2013
Release management with TFS 2013Release management with TFS 2013
Release management with TFS 2013Davide Benvegnù
 
Team Foundation Server - Source Control
Team Foundation Server - Source ControlTeam Foundation Server - Source Control
Team Foundation Server - Source ControlDhirendra Singh
 
Team Foundation Server Version Control
Team Foundation Server Version ControlTeam Foundation Server Version Control
Team Foundation Server Version ControlSteve Lange
 
Lean & Agile DevOps with VSTS and TFS 2015
Lean & Agile DevOps with VSTS and TFS 2015Lean & Agile DevOps with VSTS and TFS 2015
Lean & Agile DevOps with VSTS and TFS 2015Clint Edmonson
 
Agile project management with visual studio tfs 2013 - My presentation at Reg...
Agile project management with visual studio tfs 2013 - My presentation at Reg...Agile project management with visual studio tfs 2013 - My presentation at Reg...
Agile project management with visual studio tfs 2013 - My presentation at Reg...Om Prakash Bang
 

Andere mochten auch (16)

TFS Build - Continuous Integration
TFS Build - Continuous IntegrationTFS Build - Continuous Integration
TFS Build - Continuous Integration
 
[Curitiba DEV DAY] - Novidades do TFS 2015
[Curitiba DEV DAY] -  Novidades do TFS 2015[Curitiba DEV DAY] -  Novidades do TFS 2015
[Curitiba DEV DAY] - Novidades do TFS 2015
 
Introduction to Team Foundation Server (TFS) Online
Introduction to Team Foundation Server (TFS) OnlineIntroduction to Team Foundation Server (TFS) Online
Introduction to Team Foundation Server (TFS) Online
 
Power shell desired state configuration for Devops and ALM practitioners
Power shell desired state configuration for Devops and ALM practitionersPower shell desired state configuration for Devops and ALM practitioners
Power shell desired state configuration for Devops and ALM practitioners
 
Integrated Proposal (Vsts Sps Tfs) - MS stack
Integrated Proposal   (Vsts Sps Tfs) - MS stackIntegrated Proposal   (Vsts Sps Tfs) - MS stack
Integrated Proposal (Vsts Sps Tfs) - MS stack
 
CI with TFS
CI with TFSCI with TFS
CI with TFS
 
What's new in ALM using Visual Studio 2013 and TFS 2013
What's new in ALM using Visual Studio 2013 and TFS 2013What's new in ALM using Visual Studio 2013 and TFS 2013
What's new in ALM using Visual Studio 2013 and TFS 2013
 
Alm with tfs 2013
Alm with tfs 2013Alm with tfs 2013
Alm with tfs 2013
 
TFS 2015 Upgrade Tips & Tricks
TFS 2015 Upgrade Tips & TricksTFS 2015 Upgrade Tips & Tricks
TFS 2015 Upgrade Tips & Tricks
 
Visual Studio Code 拡張の勘所
Visual Studio Code 拡張の勘所Visual Studio Code 拡張の勘所
Visual Studio Code 拡張の勘所
 
Install, configure and customize TFS 2013
Install, configure and customize TFS 2013Install, configure and customize TFS 2013
Install, configure and customize TFS 2013
 
Release management with TFS 2013
Release management with TFS 2013Release management with TFS 2013
Release management with TFS 2013
 
Team Foundation Server - Source Control
Team Foundation Server - Source ControlTeam Foundation Server - Source Control
Team Foundation Server - Source Control
 
Team Foundation Server Version Control
Team Foundation Server Version ControlTeam Foundation Server Version Control
Team Foundation Server Version Control
 
Lean & Agile DevOps with VSTS and TFS 2015
Lean & Agile DevOps with VSTS and TFS 2015Lean & Agile DevOps with VSTS and TFS 2015
Lean & Agile DevOps with VSTS and TFS 2015
 
Agile project management with visual studio tfs 2013 - My presentation at Reg...
Agile project management with visual studio tfs 2013 - My presentation at Reg...Agile project management with visual studio tfs 2013 - My presentation at Reg...
Agile project management with visual studio tfs 2013 - My presentation at Reg...
 

Kürzlich hochgeladen

Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 

Kürzlich hochgeladen (20)

Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 

Team Foundation Server Build Automation

  • 1. Team Foundation Server Build Automation Give me a Light, Build Light Mike Douglas mike@doitconsultants.com www.CodeSmartNotHard.com www.CodePlex.com/TeamDeploy
  • 2. About Me • Current Lead Developer / Analyst at Farm Credit Services of America • Wide variety background in .NET – Web Services, Remoting, WCF, WinForms, ASP.NET, Biztalk, TFS, CSLA.NET, Code Generation • Frameworks, Code Generation, and Agile Blog – www.CodeSmartNotHard.com • Open Source Project for TFS Builds – www.CodePlex.com/TeamDeploy • 3rd .NET User Group Presentation
  • 3. Agenda • Build Automation – more than just build • Creating a build • What’s in a build – Proj, Targets, and Tasks • Creating a Custom Task • Team Deploy
  • 4. Build Automation • Should be part of a good configuration management process • Our Goal – Deploy same MSI to test as production – Separate Environments • Development, Test, Staging, Production – Continuous and “Build and Deploy” Builds – Admin Install MSIs – ConfigFiles folder for multiple environments
  • 7. What is in a build? • TFSBuild.proj – XML for TeamBuild • Targets – “Events” of the build, Before/After are overrideable for custom functionality. • Tasks – built in or custom actions that perform a set piece of functionality. Quick Demo
  • 8. Build Targets End to End Iteration Clean Get Source Build Break Build Error Label Compile Run Tests Drop Build Files
  • 9. Targets • Commonly used ones Target Name Description BeforeEndtoEndIteration Runs tasks before EndToEndIteration target. Use this to run something before the build starts. Example: Turn street light yellow. AfterEndtoEndIteration Runs tasks after EndToEndIteration target. Use this to run something after the build successfully completes. Example: Copy Binaries and Config Files to MSI, Deploy MSI, Turn on Green Street Light BeforeTest Called before tests are run. Example: Update or Prepare database or spreadsheet for Unit Tests AfterOnBuildBreak Called after a work item is created when a build fails Example: Turn on Red Street Light
  • 10. Other Overridable Targets Target Name Description BuildNumberOverrideTarget Used to override a target to customize a build number. The task you write must create an ouptut property called BuildNumber BeforeClean Called before clean is tried. Insert your task into this target to run pre-clean custom target. AfterClean Called after clean is completed. BeforeGet Called before sources are retrieved from source control AfterGet Called after sources are retrieved BeforeLabel Called before sources are labeled. AfterLabel Called after labeling is completed. BeforeCompile Called before compilation is completed. AfterCompile Called after compilation is completed. AfterTest Called after testing is completed. BeforeDropBuild Called before saving the built binaries, build log files and test results to the build- drop directory. AfterDropBuild Called after dropping the built binaries, build log files and test results to the build-drop directory. BeforeOnBuildBreak Called before creating a work item on the build that fails
  • 11. Tasks • Built in tasks – About 45 built in tasks – Complete List http://msdn.microsoft.com/en-us/library/7z253716.aspx • Custom tasks projects – SDC (over 300 tasks!) http://www.codeplex.com/sdctasks – Community Tasks (about 50 tasks) http://msbuildtasks.tigris.org/ – Team Deploy (Dedicated to Deployments) http://www.codeplex.com/teamdeploy
  • 12. Creating a custom task • Microsoft.Build.Framework.ITask • Microsoft.Build.Utilities.Task base class public override bool Execute() { DoSomething(); return true; }
  • 13. Creating a custom task (cont) • Unit Tests – BuildEngine [TestMethod] public void KillProcessExecute() { Process.Start(quot;notepad.exequot;); KillProcess task = new KillProcess(); task.BuildEngine = new MockBuild(); task.ProcessName = quot;notepad.exequot;; task.KillAppPathFilename = quot;c:pstoolspskill.exequot;; task.TargetMachine = Environment.MachineName; Assert.IsTrue(task.Execute(), quot;Execute Failedquot;); }
  • 14. Create a custom task • Demo
  • 15. Team Deploy • Today is the launch of 1.0.0! • 273 Downloads! • Set of Custom Tasks – Deploying MSIs – Controlling Devices like Lava Lamps and Street Lights • DeviceController Application • Guidance Document
  • 16. Team Deploy Features • Parallel MSI Deployments • Unit Tests • Code Analysis = Green • No unknown programs need to run on target machines • Utilizes strength and trust of PS Tools.
  • 18. Team Deploy Tasks Task Name Description Install Installs a MSI to a target machine Uninstall Uninstalls MSI on target machine by product code KillProcess Kills a process on a target machine StartService Starts are windows service StopService Stops a windows service (usually before uninstalling) DeviceController Use lava lamps or street lights to display status of builds Deploy Primary Task – Reads Deployment Script. The script contains the list of target machines, MSIs to install, any kill processes, and uninstalls.
  • 19. Device Controller • Calls the x10Communicator.exe (part of Team Deploy) to turn on and off devices • StartTime and StopTime so device doesn’t turn on at night • Device state is stored in Isolated Storage • Start and Shutdown arguments to turn all devices either on or off.
  • 20. Device Controller Parts • X10 Firecracker
  • 21. Team Deploy Demo • Street Light Demo
  • 22. Links • X10 Firecracker • SysInternals PSExec • http://www.CodePlex.com/TeamDeploy • http://www.CodeSmartNotHard.com • http://www.tfsbuild.com