Visual studio alerts workspace already exists - visual-studio

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.

Related

Visual Studio TFS Workspace Mapping Question

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.

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

TFS2012 reflect changes to server

I'm having trouble setting TFS2012 to control project source files between 3-4 people.
I've been googling for 3 days, and now I'm completely lost trying to map local and server folders in workspace. So far I have managed to create a server, a project, and connect to it using Visual Studio 2010.
All I'm trying to achieve is to share one solution between this group of people, lock files for changing, and reflect those changes to server (and therefore to other people in my group) after I check in the file I made changes to...
Can someone explain how to set this up??
Workspaces are set up the clients, not the server.
So, in Visual Studio (including Team Explorer if you have only the TFS client without the rest of VS) connect to the TFS instance and select the right team project.
If VS does not immediately prompt you to create a workspace (it's been a while since I did this on a refresh install) go to File | Source Control | Advanced | Workspaces...
There you can select or create a workspace (remember workspaces are specific to the combination of user and computer). Once you open a workspace to edit you can create mappings between source control paths and local paths.
NB. in the workspaces dialogue you can select "Show Remote Workspaces" to see other users' and computers' workspaces and copy mappings to paste into another.

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