Reputation: 82291
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?
Upvotes: 139
Views: 107640
Reputation: 107
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
Upvotes: 0
Reputation: 19330
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
After this command succeeds, you will get a Workspace Dialog - jut press OK
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.
Upvotes: 0
Reputation: 2630
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:
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.
Upvotes: 4
Reputation: 82291
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.
Upvotes: 244
Reputation: 107
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 :)
Upvotes: 3
Reputation: 2073
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)
Upvotes: 30
Reputation: 3001
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"
)
Upvotes: 0
Reputation: 1073
To avoid get and map after creating new workspace
Run cmd
Navigate to visual studio IDE path. Something like this:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE
Run this command:
tf workspaces /updateComputerName:MyOldComputerName /s:"http://MyServer/tfs/MyCollection"
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.
Upvotes: 1
Reputation: 783
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.
Upvotes: 53
Reputation: 91
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.
Upvotes: 9
Reputation: 4797
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.
Upvotes: 0
Reputation: 825
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..
Upvotes: 1
Reputation: 31
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.
Upvotes: 1
Reputation: 13419
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)
Upvotes: 16
Reputation: 459
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
Upvotes: 14
Reputation: 1
Upvotes: -2