0

There are several build processes that should be ran on the same code base.
Not in a random order, but in a specifically arranged sequence, one after the other:

┌──────────────┐    ┌────────────────────┐    ┌──────────────────────┐
│ compile code │ -> │ check the binaries │ -> │ Do something else... │
└──────────────┘    └────────────────────┘    └──────────────────────┘

How do you do that?

Egor Okhterov
  • 478
  • 2
  • 9
  • 34
  • Which version of TFS you're using? – amit dayama Sep 02 '15 at 12:08
  • Does it have to be a separate build definition? Or could you simply solve this by executing powershell after the "compile code" step succeeds? – jessehouwing Sep 02 '15 at 12:10
  • @amit: v12.0.21106.0 – Egor Okhterov Sep 02 '15 at 12:25
  • @jessehouwing: it better be a separate build definition: 1. Sometimes we want to start it manually 2. We don't want the code base to *know* about the existance of this meta logic that checks something after it is built 3. We need to get email notifications if something gets wrong (this functionality is already set-up for our corporate network) 4. There were the other important reasons that I cannot immediately recall. – Egor Okhterov Sep 02 '15 at 12:32
  • TFS Build is not really setup to handle this scenario well. You can indeed trigger a build using the TFS Client Object Model or the TfsBuild commandline, but it's not really supported by the tools and may cause issues with Test Plan configuration (which is linked to a build) and "Found in Build" work item associations. TFS 2015 and VSO are supposed to get chained builds as part of the new Build Engine that was recently introduced. – jessehouwing Sep 03 '15 at 17:48
  • @jessehouwing: what is VSO? – Egor Okhterov Sep 04 '15 at 08:59
  • Vso => [tag:visual-studio-online], the cloud hosted version of TFS. – jessehouwing Sep 04 '15 at 09:41
  • @jessehouwing: thank you, I haven't heard about it, but I think we'll stay within the tfs solution :) – Egor Okhterov Sep 04 '15 at 11:11

2 Answers2

0

you'll need to edit your defaulttemplate.xml file.

Create a new activity in your defaulttemplate.xaml file and add an argument for calling a powershell or batch script. In those script you can run the command for calling another build definition as follows:

TFSBuild start http:\myserv:8080/TFS Myproj MyBuild/msBuildArguments:"/p:RestoreSQLServer=Lamdev10"

amit dayama
  • 3,246
  • 2
  • 17
  • 28
  • Can we do this without creating additional files? Maybe it is possible to add this TFSBuild command in a build process WWF file... – Egor Okhterov Sep 02 '15 at 13:18
  • WWF file.. no idea about that. But from tfs 2010 onwards there came a concept of workflow. By default, any build definition points to defaulttemplate.xaml file which contains the workflow for that build definition(how your build definition will work.). If you need any additional functionality then you will have to edit that file. – amit dayama Sep 03 '15 at 04:40
0

To achieve your requirement, you can create a WCF service to listen to the BuildCompletedEvent event; once one build is completed, you can then queue another build programmatically.

For details about how to create WCF project to subscribe TFS event, please check: http://www.ewaldhofman.nl/post/2010/08/02/How-to-use-WCF-to-subscribe-to-the-TFS-2010-Event-Service-rolling-up-hours.aspx

To queue a build programmatically, you can use the IBuildServer.QueueBuild method.

Vicky - MSFT
  • 4,970
  • 1
  • 14
  • 22