Last year I wrote on how our org used tfs2svn to get us out of some jams when our TFS / SvnBridge / ReviewBoard solution was returning errors (Migrate TFS to SVN). We had been using that solution merrily while TFS 2008 Server was in play. Disaster struck when the infrastructure guys upgraded last week to TFS 2010 taking full advantage of the new TFS 2010 Collections paradigm. What the new Collections does is alter the URL so that part of the path after the domain is the collection and part is the repository path (ex: http://tfsserver:8080/tfs/collection/myProject/trunk where the “http://tfsserver:8080/tfs/collection/” part is the server and collection declaration and the “/myProject/trunk” part is the TFS repository path “$/myProject/trunk”.
When we tried to use tfs2svn again we were getting all sorts of errors such as when using the OpenTF mode:
System.Exception: Error while executing TFS QueryHistory ---> System.Xml.XmlException: '100' is an unexpected token. The expected token is "" or "". Line 20, position 65.
Or when using the MS Team Explorer mode:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.TeamFoundation.Client, Version-18.104.22.168, Culture=neutral, PublicKeyToken=[string]' or one of its dependencies. The system cannot find the file specified.
What is occurring is that tfs2svn is recognizing that its TFS libraries (v22.214.171.124) are lower than the source TFS server (v10.0.0.0) and it is also programmed to take everything after the domain as the repository path which means it doesn’t handle the Collections portions of the URL. The creator, Kevin Colyar, mentioned in this post (https://sourceforge.net/projects/tfs2svn/forums/forum/772710/topic/4548185) in May 2011 that he will not be supporting the project past TFS 2008. Fortunately the source is available and some people had already made headway getting it to work with TFS 2010 (in the same post). I took what the anonymous posted mentioned and ran with it to great success.
The 2 major things we needed to fix was to update the dependency references (.Net Framework 4 and use the TFS 10.0.0.0 libraries) and to update the code to understand where the Collection part of the URL ends and the repository path part begins.
Steps in a nutshell:
- Install Visual Studio 2010 Ultimate (I grabbed the iso from the MSDN account). Takes ~45 mins.
- Run VS 2010 and select General Develpment mode if prompted.
- Download the Tfs2svn source:
svn co https://tfs2svn.svn.sourceforge.net/svnroot/tfs2svn/trunk C:tfs2svncode
- Open the project (C:tfs2svncodetrunktfs2svn.sln)
- Conversion Wizard opens:
- Create backup: No
- Summary: Finish
- In the Solution Explorer right click on each project (ex tfs2svn.Winforms) > Properties > Application tab:
- Target framework: .NET Framework 4
- Close and reopen to take effect.
- Repeat for all projects.
- Modified the tfs2svn source code (see diff).
- Built to C:tfs2svncodetrunktfs2svn.WinFormsbinRelease
- Copy SVN 1.6 (svn-win32-1.6.13) into libssvn-win32-1.6.13.
- Modified the tfs2svn.Winforms.exe.config to point to the new libssvn-win32-1.6.13
- Run tfs2svn.Winforms.exe.
The new field is available and we can distinguish between the server url and the repo path. I essentially added a new field “TFSRepo” to split out the TFS server w collection (http://tfsserver:8080/tfs/collection/) and the repository ($/myProject/trunk). I needed to add the field to the UI, config, and logic code for parsing the paths.
Note: I tried using the OpenTF 0.5.2 alpha libs but they were not working “well”. Perhaps the newer 0.6.0 will work but I didnt try. For this solution use the MS Team Explorer client libs.
Edit: Brandon (comments below) added that TFS Team Explorer needs to be installed then use the MS Team Explorer option in tfs2svn2012. Thanks for testing Brandon!
Bin and Diff
The link below is for the files changes to Rev 106. Checkout rev 106 then replace with the changed files below:
The next link is for the Built binaries. You will need to download a copy of SVN since I didnt include it: