My experiences getting started with writing custom adaptors for TFS Integration Platform

The TFS Integration Platform is an ALM Rangers project that provides an excellent set of tools to migrate or synchronise source code and/or work items between different TFS servers or TFS server and third party platforms. For many people the supported release on Code Gallery will do all they need. However if you have a need to connect to a system that there is no adaptor for you need the Codeplex version so you can write it yourself. To get the environment up and running, not unsurprisingly, the best place to start is the Getting Started documents.

I did this, I got all the pre-requisites (or so I thought), I download the code and unpack the zip. I ran the  extract_tfs_assemblies.bat to get the local copies of the TFS API assemblies and loaded the MigrationTools.sln in VS2010.

First thing I noted was that I was asked to convert the solution and project files to 2010 format, though they appeared to be the right format to start with. I did this but the report showed no changes, strange!

On loading the solution, other than the ‘TFS offline’ dialog the instructions mention, it also reported it could not load the InstallationCS.csproj file because

C:\Projects\ITIS\IntegrationPlatform\Setup\InstallationCA\InstallationCA.csproj(133,3): The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.5\Wix.CA.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

The Wix directory for the current distribution is C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x, a quick edit of the InstallationCA.csproj in notepad to correct the path fixed this load problem (wonder if that was why VS2010 though it needed to do a solution upgrade?, I could not be bother to roll back to find out.)

I then tried to build the solution, and got around 150 errors, starting with the error

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(292,5): error MSB8009: .NET Framework 2.0/3.0/3.5 target the v90 platform toolset. Please make sure that Visual Studio 2008 is installed on the machine.

I checked and this targets file was there. I had VS2010 and VS2008 installed what could be the problem?

Well it turned out that though I had VS2008 installed I had (for some strange reason lost in the mists of time) not selected the C++ components. Easy to fix you would think. Just go into control panel, into installed products and add the missing features, so I tried to add C++ and got the message

A selected drive is no longer valid. Please review your installation path settings before continuing with setup

I tried inserting DVDs, mounting ISO etc. all to no avail. The found on this forum post, turns out you have to remove VS2008 SP1, add the feature and then re-patch.Once this was done I could build the C++ projects.

As a side note here, I went through this process a couple of time, the first time I also managed to get the TFS adaptor projects references a bit confused. The TFS2008 adaptor projects had ended up referencing the TFS2010 assemblies. This caused a build error due to obsolete calls. This was easily fixed by repointing the references to the copies of the assemblies the extract_tfs_assemblies.bat creates. However if you remember to run extract_tfs_assemblies.bat before opening the solution for the first time this should not be an issue, as all the right assemblies will be on the correct hint paths.

So I now had 36 build errors. The next one I tackled was

Unable to copy file "C:\Projects\ITIS\TestEnv\MigrationTestEnvironment.xml" to "..\..\..\Binaries\Debug\\Test\MigrationTestEnvironment.xml". Could not find a part of the path 'C:\Projects\ITIS\TestEnv\MigrationTestEnvironment.xml'.    MigrationTestLibrary

This  was because the file was actually missing, it is not under the Codeplex source control. This is the XML file defines the adaptors under test. You need to create it based on the test you wish to run, or that is my current understanding. To get around the error (as a start) I just set it ‘copy to output directory’ property to ‘do not copy’ – knowing I would switch this back later

I was now down to 16 errors, all related to the Subversion related projects. These requires, fairly obviously, some Subversion libraries I did not have on my PC. As I did not need to work with Subversion I could have chosen to just remove these projects from the solution, but I thought why not fix it it all. They key again was to follow the readme.txt in the Interop.Subversion project folder. You need to download and unzip the two sets of source for Subversion and Apr.

I was then left with a missing reference to SharpSvn. This I downloaded from http://www.open.collab.net/files/documents/180/2861/SSvn-1.6006.1373.zip and unpacked to the {solution root}/binaries/external/sharpsvn  and made sure the SubversionTCAdapter project reference pointed to this location.

Once all this was done all the projects in the solution built. So nothing too complex really, especially when you follow the instructions in the right order!

So to develop some custom adaptors now then……