I have this problem when I queue a build. The build dies with the error
The path C:\[Path]\Sources is already mapped in workspace [Server Name].
the same as this question. but I've removed all the workspaces on the build agent by running this command:
tf workspaces /remove:*
and also by deleting the TFS cache folder. I've also restarted the server, but the error keeps happening on each build.
I was able to remove the workspace. On the build server do this:
Download psExec from sysinternals.
http://technet.microsoft.com/en-us/sysinternals/bb897553
Open cmd as Administrator.
Run psexec to open cmd as Network Service.
psexec -i -u "nt authority\network service" cmd.exe That opens another cmd window that "nt authority\network service" is using.
Run a “whoami” to make sure you’re now "nt authority\network service".
Open visual studio by typing devenv.
Within visual studio\team explorer, Connect to the source control server
Within visual studio\ source control explorer, throw away the offending workspaces.
I have no idea why, but the tf workspaces /remove was not working for me.
I think the issue appear only if you have more then one build agents on one build box.
http://blog.devaffair.com/2011/11/path-is-already-mapped-in-workspace.html
Well, actually this problem has been solved in several other questions in this site, but I'll post my answer again :)
This link will direct you to a blog which will probably solve your problem the fastest
I had the same issue - it was running fine until I installed VS2010 on the build agent. Adding the BuildDefinitionId fixed it, but it is strange that installing VS2010 would mess up the workspaces that are already set up and running.
More info about the working directory property here:
http://msdn.microsoft.com/en-us/library/bb399135.aspx
However, in the RTM version "$(HOMEDRIVE)" isn't recognized. Might be because of the casing; haven't tested it, so be aware of that flaw in the docs.
I think your problm maybe to do with having 3 build agents that are not tagged. I think the workspace, if left behind, is deleted by the agent that is doing the build. If it is a different agent to the agent that created the workspace then there will be obvious issues.
So to fix the issue you need to do the following. Name One agent the Default Agent. This will have not tags. In the other two agents, in properties add a tag for the agents, One for each agent and select that.
Now any build that is executed that has no tag set will always use the Default Agent.
To get a build to use one of the other agents, open the build definition and goto the advanced section in Process.
Open the Agent Settings and select the ellipsis in Tags Filter and enter a tag of the same name for the the tag entered on the build agent you want to use.
You may need to clear up the workspaces before the first run.
Doing the above allows you to control what build agent is used for each build definition, and therefore should also stop your workspace issue.