3
votes

We have lots of feature branches, and we don't want to manually create a build definition for each of them for continuous integration.

Is it possible to create one build definition in TFS Build 2015 that will build solution from the branch when code is checked in to it? We are using TFVC for source control.

Preferably, only the active branches should be downloaded to the build agent, as we have a lot of old branches that don't get any check-ins.

There is a similar question about old TFS Build system, but since build system was completely changed in TFS 2015, the answer would be different too - TFS build, one build for many branches

3

3 Answers

3
votes

Short answer: No.

This works for Git, not for TFVC, unfortunately.

0
votes

Actually, it would appear to work out of the box with TFS 2015 Update 2, according to a test I just ran with the following simple structure...

$/Project
$/Project/Product1/Solution1/
$/Project/Product1/Solution1/solution1.sln 
:     (and everything below it)
$/Project/Product1/Solution1-branch/solution1.sln
:     (and everything branched below it)
$/Project/Product1/Feature2/another-solution1.sln
:     (and everything below it)

Build settings: Build tab | Solution should be "**\*.sln", Repository tab | Repository should be "Project" and Mappings should include "$/Project/Product1/".

The ** in the Solution field causes it to search recursively for *.sln files, which it then builds in sequence.

I just tried this and it built all branches one after the other.

Excluding "old" branches might be more difficult if you use the single recursive approach, but you could always simply list the desired branches in the Mappings area - the nett result should be the same.

Hope that helps.

0
votes

If I understand your question, this might work for you.

enter image description here

This will build all feature branches, plus the develop (default) branch as part of CI.

Not sure why, but if you reverse the order of these it does not work.