I was working with some custom build definitions on a training course last week and one of the delegates had a failing build. After a quick visual inspection I couldn’t spot what was wrong and so I wanted a way of easily comparing the build with my working build definition.
I knew we could pull the information using the TFS API and the IBuildDefinition Interface but I came across a flag on the TFS Power Tools (tfpt.exe) builddefinition option that I hadn’t realised was there.
tfpt.exe builddefinition /diff “<Project>\<Build Definition 1>” “<Project>\<Build definition 2>” /collection:<collection url>
This gives us a really quick and simple way of comparing the build definitions and it uses the Visual Studio file comparison to show the differences.
For more information on the command, launch a Developer Command prompt and type:
tfpt builddefinition /diff /collection:<collection url> /?
So, for example on my demo setup
- Server = TFS2013
- Collection = RippleRockCollection
- Team Project = BuildDefinitionTest
- Baseline Build = BuildDefinition1
- Build for Comparison = BuildDefinition2
tfpt builddefinition /diff “BuildDefinitionTest\BuildDefinition1” “BuildDefinitionTest\BuildDefinition2” /collection:http://TFS2013:8080/tfs/RippleRockCollection
You’ll probably find an error saying:
Could not load file or assembly 'Microsoft.TeamFoundation.Build.Workflow, Version=188.8.131.52, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
You can find Microsoft.TeamFoundation.Build.Workflow.dll in:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies
and simply copy the file to:
C:\Program Files (x86)\Microsoft Team Foundation Server 2013 Power Tools
Tfpt.exe should now launch Visual Studio and make the definitions very easy to visually compare side-by-side.