TF31002: Unable to connect to this Team Foundation Server - When switching from one TFS Server to another using same Visual Studio session

When you are using the Visual Studio client to connect to say TFS 2012 server and then to say TFS 2008, you get the above error. Often times this is due to the GUID for the new TFS 2012 Server collection and your old TFS 2008 having the same GUID. It is something like this - In TFS 2008 the database server has a GUID associated with it. Now when you migrate this (old) TFS 2008 Server to the newer 2012 Server, the entire server node of 2008 becomes a project collection in 2012 and retains the same GUID.

This confuses the local Client cache in trying to maintain the same GUID based local cache for both the 2008 server and the new Project Collection in 2012. The result is the above error.

To fix this, you need to run the TFSConfig command with the ChangeServerID parameter as follows:

1)     Open elevated command prompt and change current directory to c:\Program Files\Microsoft TeamFoundation Server 12.0\Tools

2)     Execute “TfsServiceControl.exe quiesce”

3)     Execute tfsconfig changeserverid /sqlinstance:<your-sql instance> /DatabaseName:Tfs_Configuration /projectcollectionsonly .  
        Make sure to pass projectcollectionsonly parameter.

4)     Execute “TfsServiceControl.exe unquiesce”



TFSConfig -

ChangeServerID -