Visual Studio TFS Workspace Mapping Question - visual-studio

We use Azure DevOps for TFS here. This developer is receiving an upgraded workstation and is trying to setup her workspaces in visual studio. When she attempts to create a workspace on her new workstation she receives the error "The workspace XYZ already exists on computer OLD-PC".
I know I can do some hacky visual studio command prompt stuff to delete the old workspace mappings on the TFS server, but I was hoping to understand the error a bit better. Is she receiving this error because TFS workspaces mapped to a project must be unique in name? I was a bit confused why it would be giving an error for a workspace already existing on a different PC, I thought it would identify by the new PC name and workspace name and not cause an issue.
Any insight or general guidance on workspace mapping conflicts would be appreciated. I need to learn a bit more about how this works.
Thanks in advance!!!

Customer will encounter this error ‘workspace xyz already exists on computer abc’ when trying to create a new local workspace while the old workspace persists.
And testing in my side and found that TFS workspaces mapped to a project must be unique in name.
To resolve this issue, you could rename your new workspace or use the tf workspace command to delete other's old workspace. Make sure you have own manage other users workspace permission. Otherwise, you need to get your TFS administrator to delete the workspace if you have no access to the account. Just using below command.
tf workspace /delete "WORKSPACENAME;PREVIOUSUSERACCOUNT"
See: Visual studio alerts workspace already exists for more details.

Related

Visual studio alerts workspace already exists

I am having an issue with one of the users of a TFS server I manage. We recently went through a user ID change and as such this messed up some of our workspaces. I am trying to get a new local workspace made on her machine and it keeps saying that the locally mapped folder is already used for her old workspace.
We have deleted all of the TFS and VS cache folders, did userdatareset, and using the tf.exe workspaces command it does not list this offending workspace that I am trying to get rid of. Is there other approaches I can use to get rid of this workspace.
If you want to use the tf workspace command to delete other's old workspace. Make sure you have own manage other users workspace permission. Otherwise, you need to get your TFS administrator to delete the workspace if you have no access to the account. Just using below command.
tf workspace /delete "WORKSPACENAME;PREVIOUSUSERACCOUNT"
You could also use Team Foundation Sidekicks, for TFS2015, it's version 6.0
How to use the tool:
After download and install it, you need to connect to TFS
server with your current authentication.
Open tools- select workspace sidekick
In the filters, select the owner name, computer name,
access date
Finally, you should be able to delete the abandoned workspace.
Note: TF Sidekicks uses the same commands so would require the same permission. It is a TFS admin productivity tool.
More details please refer the similar question: Delete Old Workspaces on TFS VS2013
You can use Team Foundation Sidekicks to view all workspaces for that particular machine and delete the ones you no longer need.
I use it to clean up workspaces for people that left the company and workspaces that people forgot they had on their old machines. In theory, you should be able to do everything with tf.exe, but using Team Foundation Sidekicks, just makes it a lot easier.

Change TFS source control mapping in Visual Studio 2013

I have multiple solutions that were previously mapped to a hosted TFS. Their local mapping was defined as well and all the source code was up-to-date locally. I have since discontinued my TFS subscription and started using visualstudio.com as my TFS server.
I went into one of the solutions, deleted the *.vssscc files from the solution and the *.vspscc files from each nested project. When I open the solution in VS 2013, the output window gives me a message saying the the original TFS (unsubscribed now) is not available and that the solution is open offline.
As a result, when I choose the "Change source Control" option, it first asks me to log in to the old TFS whose credentials are no longer valid.
Furthermore, it tells me that the local directory I am trying to map to the new TFS is already mapped to the old TFS. How can I remove this mapping without having access to the old TFS?
Not sure if this works if you're offline, but you can remove the mapping by opening the Manage Workspaces area in Source Control Explorer (click on the ... option of the dropdown to the right of Workspace:)
Manage Workspaces -> Select your workspace -> Edit -> Remove or change your mapping.
It's probably easiest to remove the mappings using the commandline
tf workspaces /remove workspacename;owner /collection:http://urlto.old:8080/tfs/ProjectCollection
After removing the old workspace configuration for the current folder and mapping the folder to your new subscription, Visual Studio should prompt you to automatically update the solution bindings to the new server.
This will not delete your workspace from the server (which keeps track of the workspaces), but since you no longer have access to it, it should be enough to let your client forget the folder is mapped.
The answers here work when the old TFS server is available. Mine wasn't but has not been removed from the server list in VS. Removing that entry allowed me to remove the solution from source control entirely along with the mapping and add it to another source control server.

How to delete all workspaces in TFS 2010

How do I delete all workspaces on the automated build server? We had an issue where we had to keep changing the credentials on the build agent for TFS 2010, and then if we tried to deploy the build next time for all our build definitions it gave the error that the workspace already existed under a different user.
I know we can do this:
tf workspace /delete /server:http://localhost:8080/tfs/DefaultCollection 26_1_internalserver123;MYOFFICE\brian.colley
But we have to manually do that for every build definition, and we don't really know the workspace number until we try and run the build and it gives the error.
In MSDN it says you can do a /remove:, but /delete: doesn't work (or isn't even in the msdn command options which is weird). I didn't know if remove is doing something that I don't want, versus delete.
Should I do this, or will it mess up all the users in TFS on their local boxes?
c:\projects>tf workspaces /remove:* /collection:http://myserver:8080/tfs/DefaultCollection
Thanks!
Install TFS Sidekicks, you can clean them up with a nice pretty GUI.
you can filter by the build account and a machine and then delete only the specific workspaces you are interested in

Visual Studio Source Control Explorer access denied

Recently I have been working on a project and have been waiting to publish it to Azure. Before I was able to do this my local user account on my machine was changed. Now when I try to add the project solution to the solution control explorer I get "access to path [old username]/my documents/projects is denied." I have the project copied from the old user account onto the new one I am using. I opened from this location, but it still seems to reference the old path. How do I change this and/or what settings do I need to change?
I have uploaded the project into the source control explorer for the project, and the rest of the team can view it. It is possible to re-load the project from here and create a new work space mapping on the new local account? If so how can I do this?
I managed to get it moved by doing the following, thanks jessehouwing for the push in the right direction.
Closed Visual Studio
Went to old account, copied project directly to the C drive
Went to the new account, opened the project from there
Deleted mapping referenced in the picture in jessehouwing's answer
Created new mapping under a different name, because even though the old one was removed, there was still a naming conflict (I have no clue)
Mapped the source control and local folder from scratch
You will have to change your workspace mapping. If the Source Control Explorer allows you, you can open the Workspace dropdown (in the toolbar) and edit the current mapping.
If the Source Control Explorer doesn't allow you due to Access Denied errors, you can also use the commandline utility tf.exe to remove them.
tf workspaces /remove
And then create a new one through the UI or also from the commandline using
tf workspace /new
tf workfold /map
I'm re-using an old picture here, step 4 should be to fix the paths in the Workspace folders list on the bottom of the dialog :).
This is still happening in 2022 and below are steps we have resolved this "Access Denied" in visual studio (2019 in our case) for Azure DevOps Server.
Open visual studio command line and run the command;
tf workspace /delete “WORKSPACE_NAME;OWNER”
Open folder C:\ProgramData\Microsoft Team Foundation Local Workspaces and delete anything folder inside
Verify C:\ProgramData\Microsoft Team Foundation Local Workspaces
folder has the user you are logged into the machine as full access
Go back into Visual Studio and reestablish your workspaces and
perform a get latest

TFS in VS2010 "remembers" file system mappings for deleted server/workspace?

Using the TFS tools in VS2010, I had added a CodePlex server. I had mapped a project on there to a local path, say C:\MyProject Later, we moved the project to a dedicated TFS server, so I added a new TFS server, and deleted the CodePlex one. This in turn removed the "workspace" for it.
However, now if I try to map a project in the second TFS server to C:\MyProject, I get the error:
The path C:\MyProject is already mapped in workspace MY-MACHINE;SND\myCodeplexUserName [https://tfs.codeplex.com/tfs/tfs32]
If I go to File | Source Control | Workspaces... in VS, that CodePlex workspace is not listed (since I had deleted the TFS server reference)
Does anyone know of another way to remove the existing mappings?
Use the command line utility tf with the workspace and workspaces commands. You may also find the workfold command useful.
Open a Visual Studio Command Prompt and type:
tf help workspace
I had to do this the other day to delete all the workspaces for a collection that was moved to a different server. In my case, the command was tf workspace /delete /collection:<url>. Use tf workspaces to display all your current workspaces.

Resources