Some words about Bild Reasons…

Build reason seems very straightforward to understand.. However it can give some surprises – at least it gave to me. So here comes some explanation how doe it look like on a bit deeper level.

Build Reason values

Build Reason is stored in an Enum with FlagsAttribute – so many values can be selected at he same type. There are some combination already set up as values.

Combinations /  CheckInShelveset /  ValidateShelveset/  UserCreated /  ScheduleForced /  Schedule /  BatchedCI /  IndividualCI /  Manual
128 64 32 16 8 4 2 1
None 0                
Triggered 191 X   X X X X X X
All 255 X X X X X X X X

Ok.. but what values shall I get when I start a build?

Action BuildReason value
Manual start, Latest sources  Manual
Manual start, Latest sources with shelveset  ValidateShelveset / CheckInShelveset
Continuous Integration  IndividualCI
Gated Check-in  CheckInShelveset
Rolling builds  BatchedCI
Scheduled  Schedule / ScheduleForced

How to use Build Reason in the build workflow

  • You can find the build reason in the BuildDetail variable of the default workflow.
  • If you have something special, you can get this object with the GetBuildDetail activity, which returns with an IBuildDetail  instance, which has it in its Reason property.
  • You can simply use the InvokeForReason activity if you want to execute some activities for some specific build reasons only.

Effects of the Build Reason

I have not tried all, just collecting the usages and side effects of it…

– In the default build process, the Drop Folder is not created, when the BuildReason is ValidateShelveset or None, even if droplocation is specified and Copy Outputs to Drop Folder is true. In other words, if you just build a shelveset, then it won’t have any drop folder, even if you are trying to write log file into it. (Obviously you can align your wokflow to solve this…)


Mainly a developer from the .Net and also the PHP world. Many others staffz are attached also.

Tagged with: , , , , ,
Posted in TFS, TFS 2010, TFS Build

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: