Change computer name for a TFS Workspace

2019-01-20 23:29发布

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?

15条回答
贼婆χ
2楼-- · 2019-01-20 23:58

This command run in the Developer Command Prompt for Visual Studio did the trick:

tf workspaces /updateComputerName:MyOldComputerName 
/s:"http://MyServer:8080/tfs/MyCollection"

It had to be run from the computer I wanted to assign the workspace to (that is how it gets the new computer name.

查看更多
We Are One
3楼-- · 2019-01-20 23:58

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")

查看更多
孤傲高冷的网名
4楼-- · 2019-01-20 23:59

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

查看更多
来,给爷笑一个
5楼-- · 2019-01-21 00:01

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:

cd c:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE

Then I ran the command:

tf workspaces /updateComputerName:OLDCOMPUTERNAME /s:"https://MYCOMPANY.visualstudio.com/DefaultCollection"

It then told me that my new workspace matched the machine name of my new computer name.

Hope the path helps.

查看更多
Animai°情兽
6楼-- · 2019-01-21 00:03

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

查看更多
做自己的国王
7楼-- · 2019-01-21 00:04

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:

TF400813: Resource not available for anonymous access.

For me it was just easier and much faster to remove the worskpace and reconnect again:

File > Source Control > Advanced > Workspaces (remove workspace)

查看更多
登录 后发表回答