Search code examples
visual-studiotfssource-control-bindings

Visual Studio 2010 Team Foundation Server Source Control Issue


Source control is acting wierd.

Here is the scenario: I had to reformat my computer. I backed everything up first, then blew it away. All of my backup is located on a virtual harddrive on the network, which I can connect to in order to grab what I need temporarily.

I have re-added my website / project to the same file location but now source control doesn't seem to be working.

I have made some edits which I believe the second developer does not have. Also, the second developer has made some new edits to the website and because I am not properly hooked in to source control I cannot get those changes. Does anyone have any ideas on what the problem could be?


Solution

  • Your local machine keeps a cache of the server and local workspace configuration - you will need to rebuild this cache. In addition, your Team Foundation Server workspace is tied to your original computer (workspaces are uniquely identified by your local hostname, the workstation name, and your username.) If your hostname has changed on your new computer, the server will not be able to find your existing workspace and thus it will not be able to participate in source control.

    If your hostname is the same and you have copied all of your source tree over to the identical location, you should be able to simply rebuild your workspace cache on your new machine. As soon as you connect to the server (using Team Explorer in Visual Studio, or with the tf command line client) your workspace cache will get rebuild and you should have a copy of the pending changes you had on your old computer.

    If, however, your workstation's hostname has changed, you can update the the hostname associated with your old workspaces. You can do this by running the command:

    tf workspaces /updateComputerName:oldComputerName /collection:http://tfsserver:8080/tfs/MyCollection
    

    Finally, you have one other option: you can simply create a new workspace and copy your changes in. You would do this by creating a new TFS workspace, getting the latest version of the code to a different directory, copying your changes over, and then detecting those changes and pending them to the server by using tfpt online from the Team Foundation Server Power Tools.