Change computer name for a TFS Workspace

TfsWorkspace

Tfs Problem Overview


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?

Tfs Solutions


Solution 1 - Tfs

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.

Solution 2 - Tfs

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.

Solution 3 - Tfs

Go to VS command prompt and type the following:

>tf workspaces

This will provide you with the available Collections. Copy the path (essentially a URL) of your intended collection. Then type the following:

>tf workspaces /updateComputerName:"OLD_NAME" /collection:"The URL copied from above"

(exclude the quotes above)

Solution 4 - Tfs

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)

Solution 5 - Tfs

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

Solution 6 - Tfs

Given below how it worked for me.

Step 1. Go go Visual Studio Command Prompt

Step 2. In above command prompt type command tf workspaces. This command will show all the workspaces you created in your machine and also the collection name. Look carefully for first line of the result of the command.

Step 3. In same command prompt type command tf workspaces /updateComputerName:OLDCOMPUTERNAME /s:"collection name as shown above"

The OLDCOMPUTERNAME AND COLLECTION NAME ARE VERY IMPORTANT HERE.

Solution 7 - Tfs

If someone don't feel so comfortable with CommandPromt (like me) This Infographic post can help you . here is the text snippet from the blog:

Click on FILE menu on your Visual Studio 2013. Now click on

Source Control -> Advanced -> Workspaces..

This will open a window with title "Manage Workspaces". It shows the list of workspaces on this computer to which you have access. The list contains 4 columns for:

  1. Workspace Name
  2. Computer
  3. Workspace Owner
  4. Comment (if added while creating workspace)

Add Workspace: If Workspace Manager is empty, probably you didn't added one yet. Click on Add button and put your server/ username/ password and it will list the added one for you.

Update Workspace: Later if you have changed your computer name or anyway you want to update your workspace accordingly, select the workspace you want to edit and click on Edit button; here you can update your workspace details.

Solution 8 - Tfs

Answer by user: open and free worked for me. File -> Source Control -> Advanced -> Workspace

This will open a window with title "Manage Workspaces". Tick "Show remote workspaces" which showed the workspace that was blocking on of the .cs file changes. I removed and I am working fine now :)

Solution 9 - Tfs

Just to clarify for users of TFS Online (MS hosted TFS) - if your url was "mytfs.visualstudio.com" and your collection is "DefaultCollection", the commands as listed above will be:

To list all workspaces: tf workspaces /owner:* /computer:* /server:https://mytfs.visualstudio.com/DefaultCollection

To update from OldPcName: tf workspaces /updateComputerName:OldPcName /server:https://mytfs.visualstudio.com/DefaultCollection

In short, specify HTTPS, ignore the port and don't add a /tfs/ folder structure.

You can then select (and rename if desired) the workspace by going to source control explorer and using the Workspace drop down.

Solution 10 - Tfs

In Visual Studio.. Go to "Team Explorer-Home" ... you will be able to see your workspace name.. Click on it and "Manage".. Add your workspace.. This should do the trick..

Solution 11 - Tfs

To avoid get and map after creating new workspace

  1. Run cmd

  2. Navigate to visual studio IDE path. Something like this:

     C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE
    
  3. Run this command:

     tf workspaces /updateComputerName:MyOldComputerName /s:"http://MyServer/tfs/MyCollection"
    
  4. In "manage workspace", delete the added workspace (named as your current computer name), and rename the old one to your current computer name.

In this scenario you don't need any extra get and map.

Solution 12 - Tfs

I had the same problem and came here. But then I just closed and reopened visual studio and it was fine. So... that might be the solution for some.

Solution 13 - Tfs

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

Solution 14 - Tfs

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

Solution 15 - Tfs

In VS2017/2019 I've just completed changing the computer name for the workspace. And it goes as following:

Command: tf vc workspace WORKSPACE-NAME /computer:NEW-COMP-NAME

enter image description here

After this command succeeds, you will get a Workspace Dialog - jut press OK

enter image description here

Now you can go to your Visual Studio in your new computer or old renamed computer and workspace will appear there without restarting VS.

NOTE: above ^^ - considering that domain user is the same.

Solution 16 - Tfs

  1. Make a copy of project folder
  2. Map original local folder in TeamExplorer/SourceControl
  3. Set read-only attribute to original local folder and sub-folders
  4. Load project from original folder, Go online and Get latest version. Local files will be overwritten.
  5. Close solution, delete original folder, restore copy with original folder name
  6. Open solution, Go online and you can check-in files without conflicts.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionVaccanoView Question on Stackoverflow
Solution 1 - TfsVaccanoView Answer on Stackoverflow
Solution 2 - TfsGregView Answer on Stackoverflow
Solution 3 - TfsollehView Answer on Stackoverflow
Solution 4 - TfsUlisesView Answer on Stackoverflow
Solution 5 - TfsKarsonView Answer on Stackoverflow
Solution 6 - TfsVishal KambleView Answer on Stackoverflow
Solution 7 - TfsShriView Answer on Stackoverflow
Solution 8 - TfsMandiView Answer on Stackoverflow
Solution 9 - TfsitomeshiView Answer on Stackoverflow
Solution 10 - TfsAdithya KumaranchathView Answer on Stackoverflow
Solution 11 - TfsMahdi ShahbaziView Answer on Stackoverflow
Solution 12 - TfsJeff DavisView Answer on Stackoverflow
Solution 13 - TfsDave SmashView Answer on Stackoverflow
Solution 14 - TfsSteve GrayView Answer on Stackoverflow
Solution 15 - TfsT.S.View Answer on Stackoverflow
Solution 16 - TfsGarisView Answer on Stackoverflow