Problem with TFS Custom Arguments

We have a TFS build that uses the FinalBuilder XAML template and farms out to FinalBuilder for a portion. Generally works great. 

I am trying to pass a parameter from the TFS bulid definition into the FInalBuilder script. The problem is that the project variable on the FB side is not getting set with the correct value and maintains the default. Not sure what the issue is. I am using FB v7.0.0.3319.

Steps:

1. Create a project variant variable in the “Team Build” section called “Branch”. Set the default value to “Main”.

2. Bring up the details of the “Get Team Foundation Build Parameters” action. Associate Custom Argument 1" to the “Branch” variable. Save and check-in the fbp7 file.

3. Use %Branch% in the relevant places in the FB project.

4. Set the TFS build definition custom arguments field to something like “ChildBranch”. Save the build definition.

5. The build executes but the Branch variable is always set to “Main” and not “ChildBranch” like I would have expected.

 

From the TFS build log: 

:
Build Agent Working Directory : D:\Builds\2\CI\root
        (saved to variable BuildRoot)
        Custom Argument 1 : ChildBranch
        Custom Argument 2 : 
:
     [Set File Attributes [D:\Builds\2\CI\root\src<strong>Main\blah\blah.txt - ReadOnly:Clear]]
:

The “Main” in the path above should be “ChildBranch”, but FB used the default, “Main”. 

Any idea what the issue is? The value is passed from TFS as expected but is not being assigned to the %Branch% variable by FB.

Thanks.

What version of TFS are you using?

The FinalBuilder Activity passes the Custom Arguments as environment variables to FBCMD. Try adding a Log Variables action to your FinalBuilder project, and set it to log all variables. It should show variables _envCustomArg0 … _envCustomArg9. What does that show?

Thanks for the reply. I will try that tomorrow. TFS Version is 2013 Update 4.

I am assuming that I only have to supply the string in the TFS build definition and not something like “Branch=ChildBranch”. I couldn’t find much in the way of docs on this, but it seemed reasonable to just supply the string as long as the custom argument is mapped to the right variable in the FB activity.

Yes, you just need the supply the value in TFS, and then specify the variable to map it to inside FinalBuilder.

To close the loop, looks like user error. My build definition was referring to a slightly older FPB7 file that did not contain the “Branch” variable mapping. Once I fixed that, the Log Variables action reported that the first custom argument was saved to the “Branch” variable, and all is good.

My bad. I appreciate the reply, and the addition of the Log Variables action is what helped me think through other possible issues.