I have modified the Default TFS build template to include the Finalbuilder activity. I have modified the name of the Result variable, which is in the create workspace activity, and updated it in all the places it is being used (the Finalbuilder activity uses this) and elsewhere in the build template, but now, when I re-use this name in the Finalbuilder activity (and only in the Finalbuilder activity), I get an error:
Variable is not declared. It may be inaccessible due to its protection level.
If I look at the variables pane in VS2010, it shows the Workspace variable, but nothing about changing the accessibility level. How could I do this? I appreciate this is a VS2010 question rather than strictly related to TFS2010. I looked at the example TFS workflow that comes with Finalbuilder and that hasn't help me. Any suggestions welcome.
Hi Blade, Without seeing your xaml, the first thing that I’d check is the scope of the variable. If you haven’t modified the FinalBuilderBuild.xaml much, the scope with the variable will need to be ‘Run On Agent’.
1) I keep thinking that variable scope is down to access modifiers, which I can't find anywhere. It seems like it is down to where in the workflow the variable was declared, and where I am using it.
2) I have taken the FinalBuilder task and copied it into the standard TFS2010 Default template. This has lots of activities, containing smaller activities. If an activity is nested, the scope of the variable is only usable in that scope (much like in C#). So I was trying to use a variable declared near to the top of my script, and was nested, at the bottom.
Does the FinalBuilder task only work with the Finalbuilder xaml file?
The FinalBuilder task should work in any xaml file that provides it with the correct input. It uses the standard TFS extension points: a xaml Activity and a C# CodeActivity.
If you want to save yourself some pain though, start with the supplied xaml files. They are modified versions of the default TFS xaml template anyway. In my experience, customising the TFS xaml files is time consuming and frustrating. Debugging them is even worse.
The easiest way to check which variables an activity has access to is to select the activity in the visual xaml designer, then open the Variables window - it will list all variables the activity has access to as well as the scope in which the variable is declared.
Also, ensure you haven’t marked the variable as read-only.
Well it looks like it is best to use the FinalBuilder xaml file. Is there any functionality lost in the build if I use the FinalBuilder xaml file, as opposed to the Default XAML file? The reason why I ask is because the Default xaml file has a lot of stuff going on.
For FinalBuilderBuild.xaml, the call to MSBuild and MSTest was replaced with a call to FinalBuilder. For FinalBuilderPostBuild.xaml, FinalBuilder was inserted after the existing activities.
There may have been some other minor modifications to get things working, but the the rest of the default functionality should be there.