A while ago somebody asked me for an easy way to move source from one TFS to another. He struggled with that, because TFS kept asking for the old server.
Even when he removed all the *.vssscc files and unbinded the solution with [Change Source Control] the old server popped up again and again.
I created an easy step by step guide that makes moving from one TFS to another TFS a piece of cake..
The main problem is in the workspace. A workspace mapping contains a reference to a local folder. A local folder can only be part of 1 workspace, regardless of the TFS Server it belongs to. This makes sense because if this is not the case, you can have source changes from other servers modifying your code.
Read more about workspaces in my previous posts:
For this purpose I created a Team Project on my own DefaultCollection called [MoveSource_SourceProject]. In this project I created a solution with 1 class Library call [TestMoveSource].
Then I created a workspace that mapped this DefaultCollection project to a local folder.
For the target I repeated the steps.
I created a new Team Project [MoveSourceTargetProject] on another TFS Collection, called [PlayCollection].
I did not create a workspace for the target project.
Change TFS Server, without changing the location of the source
To change only the TFS Server we need to do some things do make this happen.
- First we need to make sure that everything we want to move is checked in
- Then, remove the workspace on the source server. Nothing will be deleted on your disk. If you do not trust, try to do it with a newly created dummy workspace.
- It pops up a dialog that all pending changes will be lost if you continue. Since you checked in at the first step, press OK to continue.
- Now, your solution is unbound from source control
- Go to your target server, and create a new workspace which maps the new location to the “old” source folder
- When it pops up a dialog to Get the latest version because the workspace changes, press [No]. We do not want to mess up our current folder
- Open the solution from the “old” (or actually current) location by double clicking the solution file
- Right click the solution and choose “Add Solution to Source Control” on the context menu
- TFS Automatically recognizes the workspace mapping and adds the file to the correct server.
- Check in your changes and you’re done !
Hope this helps!