Using TFS data in FinalBuilder

   

To use TFS data in FinalBuilder you need to make use of some TFS-specific actions. To get you started, there is an example project in <FinalBuilderInstallDir>\TFS Templates called TFSExample.fbp7. This project contains actions to perform a basic TFS-integrated build.

 

TFS2010_ExampleFBProject

 

The project contains 6 actions and some related Project Variables:

Get Team Foundataion Build Parameters assigns TFS data to the specified project variables. There is no need for you to modify this action.

 

Build VS.NET Solution builds a Visual Studio.NET solution. On the [Solution] tab you will see that the Solution File is set to %SourceRoot%\<YourSolution>.sln. Replace <YourSolution> with the name of the solution that you wish to build. Also note that Configuration is set based on the values coming from TFS.

 

On the [Paths] tab you will see that the Output Directory is set to %SourceRoot%\Binaries. You may change this if you wish, but it's it not necessary.

 

Run MSTest uses MSTest to run your test assemblies. On the [Settings] tab you will see that the Test Container is set to %SourceRoot%\Binaries\<YourTestAssembly>.dll. Replace <YourTestAssembly> with the name of your test assembly, or add other assemblies to the list. On the [Publish Results] tab the action is set to automatically publish the results to the TFS server, you can change this if you like.

 

Move Files moves the built and tested assemblies to the drop location.

 

Trigger Files Iterator is a special action that iterates through the list of files that triggered the build. In TFS-lingo, it is iterating through the changesets associated with the build. Like [Get Team Foundation Build Parameters], this action populates project variables with data from TFS.

 

Log Variable Values simply logs the trigger files data. It's provided as an example of how you access the data, should you wish to use it for another purpose.

 

Important Notes

The [Ignore Failure] option is checked for the MSTest action. If any unit tests fail, the MSTest action will fail, and setting [Ignore Failure] allows the FinalBuilder and TFS builds to continue. Un-check [Ignore Failure] if you would prefer the build to halt on failed tests. In either case, test failures will appear in the TFS build log and in TFS reports.

 

Because the drop location may be on a different server to the build agent, it is important that MSTest runs on files located on the build agent. Unless you explicitly set up the trust relationship, .NET will not allow executing of assemblies on remote machines. This is why we build and test in a directory under %SourcesRoot% and then move the files to the drop location after testing.

 

Removing MSTest

 

If you do not want to use MSTest, you can delete the [MSTest] and [Move Files] actions. Then, edit the Build with VS.NET action and change the Output Directory (on the [Paths] tab) to be %DropShare%.

 

Customising the Project

The FinalBuilder project running via TFS should be able to execute actions as per usual. Just keep in mind that you are executing on a Build Agent using credentials that the Agent runs under.