Unable to remove mappings from workspace in VS2022 - devops

We've recently switched servers for our DevOps and I'm having a hard time getting VS2022 to setup the workspace mappings.
I've been able to connect to the new server fine but I'm unable to map workspaces with the error "the working folder is already in use by the workspace". Running tf workspaces /owner:* shows the workspaces and I can remove these with workspaces /remove:* but as soon as I open VS22 they reappear. I've removed the Cache directory at C:\Users\<ME>\AppData\Local\Microsoft\Team Foundation\8.0 with no affect.
Currently, when opening a local solution now, I get the message "You must configure your workspace mappings to open solutions for this project" under the 'Solutions' section of Team Explorer.
How can I remove the workspaces / mappings without mapping to a new copied folder - what am I missing, where are these mappings actually defined?

Related

Not able to Map Workspace in local folder using VS 2017

I was trying to map workspace, due to some issue I have canceled the process and deleted the entry from Manage Workspace.
But when I retried the process, I am getting below error
"The workspace [workspaceName];[Owner] already exists on computer [ComputerName]"
I have tried below things to resolve it
1) using VS Command prompt
First display list of workspaces for named computer giving workspace name and owner:
>tf workspaces /computer:oldComputerName /collection:”http://devsrvr:8080/tfs/DefaultCollection”
To delete:
>tf workspace /delete WorkSpaceName;OwnerName /collection:”http://devsrvr:8080/tfs/DefaultCollection”
But listing command is not showing any workspace. so this option dosen't help me.
I got the help reference form here
2) Tried Repair Local Visual Studio TFS Workspace Mapping by clearing cache data from %localappdata%\Microsoft\Team Foundation\5.0\Cache. This option also didn't work for me. I am still getting same error. Reference
3) Checked Control Panel >> User Account >> Mange Password for deleted the enetries (It is used to work with older VS version). But this also didn't work.
Please let me know if any one know the resolution.
You may try the items below:
Close VS.
Removes the specified workspace entry with the command line: tf workspaces /remove:(*|workspace1[,workspace2,...]) /collection:(*|TeamProjectCollectionUrl)
Delete the workspace with command tf workspace /delete [/collection:TeamProjectCollectionUrl] workspacename[;workspaceowner] [/login:username,[password]]
Create a workspace with new name and then retry deleting the old workspace.

TFS 2013 Workspace Mapping Error During Team Build

When we do team builds using tfs 2013 we occasionally get the following error:
Exception Message: Unable to create the workspace '41_9_UKBOLTFS6' due to a mapping conflict. You may need to manually delete an old workspace. You can get a list of workspaces on a computer with the command 'tf workspaces /computer:%COMPUTERNAME%'.
Details: The path C:\xxx\xxx\xxx is already mapped in workspace 41_9_UKBOLTFS6. (type MappingConflictException)
If we kick off a new build it may succeed, if not we try again and eventually it works without any changes.
I have seen very similar questions posted on stackoverflow about this but non where the workspaces it is complaining about are the same '41_9_UKBOLTFS6'.
We migrated most of our builds from TFS2010 but not all and we never had this issue before.
Does anyone know what is going on?
This occurs (as the error suggests) when you have a workspace clash on the build server. Workspaces are saved as configuration values in the TFS database so clashes are possibly caused by:
you have created a new build definition with the same name as a previous build definition.
some part of your workspace name (or an artifact within your project) is over 260 chars
build definition is not using $(sourcedir) macro in System Settings tab
More details are explained in this article
Possible work-around:
Rename your build definition to something unique.
Looks like you have multiple team builds mapped to the same local directory. Make sure that the Working Directory in all your agents are unique and there is no absolute path in workspace settings of your build definitions
I've run to this issues and blogged about my solution without renaming the build definition. Check it out here: https://christiaanmolendijk.nl/2016/05/23/before-stressing-out-tfs-cache-folder-on-build-server/
Summary of the link:
Go to cache folder: {userprofile}\AppData\Local\Microsoft\Team Foundation\{version}\Cache
Edit file VersionControl.config in Volatile folder
Then go back to the cache folder at {userprofile}\AppData\Local\Microsoft\Team Foundation\{version}\Cache and delete the folders with a GUID as name.

Phantom TFS workspace will not let me map to another workspace?

I type this command: tf workspaces into a command line and it tells me there are no workspaces on the machine. I then try the same command on the server, nothing. So I go into Visual Studio 2010 and create a new workspace and try to map the TFS path to my local path. I then get an error that the mapping already exists in another workspace. But I cannot find that workspace on my local or on the tfs server. Any ideas?
You can run tf workspaces /remove:* to clear out your local cache of workspaces. See this link for more details.
I know this is an old question, but I just came across this issue on a Linux machine running TEE (Team Explorer Everywhere). Running "tf workspaces -remove:*" didn't work, because it said there were no workspaces in the cache.
The user was trying to create a new workspace, which worked, but when he tried to map folders, it told him it didn't exist.
When he ran "tf workspaces" on the machine and when I looked in TFS Sidekicks on the server itself, it didn't show any workspaces for him on the Linux box.
If he tried to create the workspace again, it told him that it already existed, but every time he tried to map, he was told it didn't.
We could see the workspace from the tf command line if I did "tf workspaces /owner:", and it required me to run "tf workspace /delete ;" from the command line to get rid of it.
Once we did that, he was able to create it again and everything worked properly.
No idea why that happened, but figured I'd post my answer here just in case someone else comes across a similar issue in the future.

TeamCity with TFS - workspace problems

We have been using CC.NET as our CI server for a month or so now, which has worked ok with TFS. In the config we were able to specify the TFS server, username, password, project and workspace which is all good.
Now we are moving over to TeamCity mainly because it just seams more solid and is much nicer to use. The problem is getting it work with TFS.
For the purpose of this, both the workspace and machine name are "BuildMachine", username is "BuildUser" TFS project is "$/Project/Dev/Website"
I seam to have set it up correctly, I think, as when testing the connection it is successful. When I run a build I get a TFS error: "RunBuildException when running build stage UpdateSourcesFromServer."
It goes on to say: "No matched workspaces were found. Will recreate workspace and perofming clean checkout."
It then tries to create a new workspace something like this: TeamCity-S-sqa9qe2aulx22gz4rzkogl5kr/BuildUser
It tries to set up some mappings and then fails because: "The working folder C:\ is already in use by the workspace BuildMachine;BuildUser on computer BuildMachine".
This seams ok as this is the workspace that CC.net was using, and c:\project\dev\website is the path to the project. The problem is, why didn't TeamCity pick this up and use this workspace? Why does it try to create its own new one? Any idea how I can fix this?
Thanks
I seem to have fixed this by simply changing the path for the BuildMachine workspace to c:\BuildMachineWorkspace\ instead of just c:\.
I guess this means that the whole of c:\ is no longer a workspace therefore other workspaces can be created on c:\.

Team Build Error: The Path ... is already mapped to workspace

When creating a new build in Team Foundation Server, I get the following error when attempting to run the new build:
The path
C:\Build\ProductReleases\FullBuildv5.4.2x\Sources
is already mapped to workspace
BuildServer_23.
I am unable to see a workspace by that name in the workspaces dialog.
Use the command line utility TF - Team Foundation Version Control Tool (tf).
You can get a list of all workspaces by bringing up a Visual Studio Command Prompt then changing to your workspace folder and issuing the following commands:
C:\YourWorkspaceFolder>tf workspaces /owner:*
You should see your problem workspace in the list as well as it's owner.
You can delete the workspace with the following command:
C:\YourWorkspaceFolder>tf workspace /delete /server:BUILDSERVER WORKSPACENAME;OWNERNAME
Just delete the contents of the following folder(s):
C:\Users\UserName\AppData\Local\Microsoft\Team Foundation\3.0\Cache
Where UserName is actual or current user, and 3.0 is the version number.
I had a similar issue and to remove the workspace that was causing me a problem, I logged into another machine with TFS client installed and performed the following:
On the File menu, point to Source Control, Advanced, and then click
Workspaces....
In the Manage Workspaces dialog box, tick the Show remote packages checkbox.
Under the Name column, select the workspace that you want to remove, and then click Remove.
In
the Confirmation dialog box, click OK.
I received this error, which was caused by having two build definitions that pointed to the same source. The issue was that I used a static build directory in the Build Agent.
This forum post describes my issue and resolution exactly:
http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/60a4138a-9b28-4c46-bdf4-f9775ce43c3e/
We had the same problem but deleting the workspace's from the TFS server did not work.
(I should mention that I grabbed my colleagues VM that was already set up with his credentials.)
For me this worked:
http://blogs.msdn.com/b/buckh/archive/2006/09/12/path-is-already-mapped-in-workspace.aspx
I just went into the : ...\Local Settings\Application Data\ made a search for VersionControl.config, opened up the folder that contained this file and deleted all of it's contents.
Previous to that I tried manually editing the file but it continued with the same error message.
I hope this helps.
For some reason I was having trouble deleting the workspace from the command-line utility. Luckily I found Team Foundation Sidekicks 2010 (from this post) which is free and provides a GUI for viewing and deleting TFS workspaces, and many more useful TFS features.
I had a similar problem with Visual Studio 2010 complaining about an already-mapped-workspace, but instead of deleting the entire workspace, I used the following from the Visual Studio Command Prompt: "tf workspace PROBLEM_WORKSPACE_NAME". This brought up an "Edit Workspace" dialog. From there I was able to remove the path in question from the "Working Folders" list, which got rid of the error.
the rest was fairly easy.
Simply go to this folder:
C:\Users{UserName}\AppData\Local\Microsoft\Team Foundation\4\Cache
and delete all that's in the folder.
I was getting an exception telling me that the file was already mapped in another workspace:
"The path {File Path} is already mapped in workspace {Workspace Name}."
This workspace was deleted beofre.
With the help of friend of mine I found out that TFS save workspace info under the user local settings dir. We found a file named:
VersionControl.config under {User Documents and Settings dir}\Local Settings\Application Data\Microsoft\Team Foundation\1.0\Cache.
This file contains all the local mapping of TFS. Probably when you use the Map method and don't use:
public void DeleteMapping(WorkingFolder mapping); before deleting the workspace the mapping information is not removed from this file which is used by TFS to check if you've alreay mapped a specific path.
To resolve this problem delete all the keys from the config file. Don't delete the file because you'll get it again from the server cache.
Here is what I did (well what I do):
Using TFS Sidekicks clear out the user and server filters so they are blank. This will let you get all workspaces.
Check the build error for the workspace name. In the OPs case it is BuildServer_23. It is different in my environment but basically just match up the error name with the one in the tfs sidekick list.
Click the red x to delete the workspace.
Viola!
If applicable, you can also clone the build definition and change its name. This workded for me.
I tried all the following solutions such as :
Use sidekicks to delete WS.
Use tf commands to delete remote server workspaces.
Delete the TFS cache folder.
The following worked for me:
tf workspaces /remove:*
If you don't have permissions on the server to delete other people's workspaces, you can just change the name of the build definition. TFS will create a new workspace and map it to "C:\Build\ProductReleases\new build name here\Sources".
While trying to 'Get latest version' of a project which I had previously mapped to a local directory and then deleted, I saw this same error message.
First I tried the SideKick tool and then the Visual Studio 2010 command prompt, both of which told me I had no workspaces mapped.
Next I searched for 'VersionControl.config' within c:/users/myuser/appdata, and deleted the 4 references it found.
I re-opened Visual Studio and I was able to re-map the project, no more error!
Simplest way to do this is to go to your AppData and delete the TFS cache (depending on the version 3.0 or 4.0)
C:\Users{UserName}\AppData\Local\Microsoft\Team Foundation\3.0\Cache
or
C:\Users{UserName}\AppData\Local\Microsoft\Team Foundation\4.0\Cache
TDN's solution worked for me when I was having the same issue. The Build server created workspaces under my account. Checking this box allowed me to see and delete them.
I got same issue in Visual Studio 2017 and TFS 2017. DefaultCollection must be mapped first to you local path. Somehow this step was skipped and I got only MyFirstProject mapped.
All you need to do is:
- 1. Go to your TFS web page and remove the project from the server.
- 2. Remove the project from your local "Worksapces"
- 3. Go to "Manage Connections" which will refresh your Home page in TeamExplorer.
- 4. You will get Configuration page which will allow you to setup root path to your DefaultCollection.
- 5. You should get message that it been done successfully. Now you can create your project.
It's important to map root of your collection to your workspace first and then map a new project.
My issue was related to using multiple accounts. This is how I was able to switch accounts.
Open Team Explorer
From the big drop down menu near the top of the pane...
Navigate to:
Projects and my Teams>Manage Connections
Navigate to:
Manage Connections>Connect to Team Project
Use the "Switch User" link to switch accounts.
Now the workspace names will match the chosen account.
I couldn't get any other solution to work.
I had a new account created and the old account no longer had permissions (both on same machine).
I tried:
1) Deleting the workspace (couldn't see in VS with or without remote workspaces checked)
2) Deleting from the command line
3) New owner command
4) Deleting the cache
So I simply opened VS as admin and mapped to a different folder.
Deleting the workspace and cache was not sufficient for me.
I had to also restart the "Visual Studio Team Foundation Build Service Host" service.
Go to the Source Control Explorer
In the toolbar there is a dropdown list of Workspaces.
Click the dropdown and go to workspaces.
Remove the unwanted workspace.
Map to your local.
I changed
Build Definition -> Workspace -> Build Agent Folder
from
c:\some\path
to
$(SourceDir)
and it fixed the issue.
I had this issue with this with Azure DevOps automated builds in an on-prem TFS build agent. Removing the workspace using TFS Sidekicks did not work. And tf.exe could not even find the workspace to delete it.
This solution should work for TFS 2017, TFS 2018, Azure DevOps, and possibly other versions:
Take note of the workspace GUID in the error message.
On the machine where the build is taking place, navigate to: %USERPROFILE%\AppData\Local\Microsoft\Team Foundation\ (where %USERPROFILE% belongs to the user that triggered the build).
Search for and remove all instances of the workspace GUID under that directory. There will likely be a folder in a 'cache' directory, as well as entries in 'LocationServerMap.xml' and 'LocalItemExclusions.config'. Remove them all.
That worked in my circumstance.
Simply delete the workspace:
workspace /delete "the-workspace-name"

Resources