My System Administrator renamed my computer. So where it was "MyLaptop2" it is now just "MyLaptop".
So now all my source control bindings and checked out files are looking for a workspace with "MyLaptop2".
Is there a way to redirect that workspace to my renamed (but still the same) computer?
This command run in the Developer Command Prompt for Visual Studio did the trick:
It had to be run from the computer I wanted to assign the workspace to (that is how it gets the new computer name.
To expand on some earlier answers, my collection name had some spaces in there. Even if the collection name is surrounded in quotes (
"http://1.2.3.4:8080/tfs/My Collection Name"
) you need to replace any space characters with%20
to resolve the name properly (tf workspaces /updateComputerName:MyOldComputerName /s:"http://1.2.3.4:8080/tfs/My%20Collection%20Name"
)Vaccano was correct, however, I needed the workspace name after the UpdateCompterName switch. In my case the workspace was the old machine name.
If you don't know your workspace name you can find all workspace names using:
tf workspaces /owner:* /computer:* /server:http://MyServer:8080/tfs/MyCollection
So I ended up with the following.
tf workspaces /updateComputerName:MyOldComputerName MyOldComputerName /s:http://MyServer:8080/tfs/MyCollection
Vaccano's solution worked for me. It took me several tries to get the TFS URL right, so I thought I'd post it for those of you who are using Microsoft's Visual Studio TFS hosting (currently free for small teams).
From a command prompt on my computer, I first changed to the right directory:
Then I ran the command:
It then told me that my new workspace matched the machine name of my new computer name.
Hope the path helps.
I had to do this in the Developer Command Prompt for VS:
C:\Program Files (x86)\Microsoft Visual Studio 14.0>tf workspace /delete /server:http://tfs.mysite.com:8080/tfs/defaultcollection devshed22;Warren
I tried running the commands mentioned in the other answers; however, my project is hosted in TFS online (visualstudio.com) so I needed to authenticate first since I kept getting this error message:
For me it was just easier and much faster to remove the worskpace and reconnect again:
File > Source Control > Advanced > Workspaces (remove workspace)