Oh what a P.I.T.A. this error has been. I received this error today…
Microsoft.TeamFoundation.VersionControl.Client.ItemExistsException: The item $/path/to/myFile.cs already exists. —> System.Web.Services.Protocols.SoapException: The item $/path/to/myFile.cs already exists. — End of inner exception stack trace — at Microsoft.TeamFoundation.VersionControl.Client.Repository.ProcessHttpResponse(HttpWebResponse response, Stream responseStream, WebException webException, XmlReader& xmlResponseReader) at (…)
blah blah blah…
We have two build servers set up at the client where I’m at and I’m in charge of keeping them up and running smoothly.
Build Server 1: Local, same office as where our TFS Server is
Build Server 2: Remote, connects via TFS Proxy Server at the remote location which connects to our TFS server (next to Build Server 1)
PROBLEM
The problem is that I recently moved a project using the Move command in TFS.
The project was moved from a location which was incorrect for our Continuous Integration environment to a location that that was optimal.
Between the time that this move occurred and when the project was altered again, a file was dropped from TFS somehow yet it remained in the project. Not a big deal right? I asked a coworker to add it through Team Explorer. Bam, no problem, done. The file was back, it built correctly on our development machines and we went onto the next task.
Then CC.NET Barfed. It was the error that is in red above.
Robert Horvick had some great insight into this error on this post. Here’s what he says:
“At a high level what is happening here is that there are two distinct items which happen to have the same path name (at different points in time, obviously). When you are labeling TFS sees what you want to put into the label (the new item) and what is already in the old label (the old item) and sees the name conflict. Since /child:replace means to replace the label on the same item it can’t drop the label off the old item which means it can’t add it to the new item so it issues this error message.“
THANK YOU Robert.
SOLUTION
As Robert also stated in that post we have to “unlabel” the file so CC NET can re-label it correctly. We’re getting rid of the old label on this file. We do this with the “tf unlabel” command.
tf unlabel 1234 “$/Path/to/myFile.cs”
(where 1234 is the label)
I did this, and then forced a build through CC.NET and it worked! Woo hoo!
UNTIL… the next build, it broke, and I get the same exact error message above.
After some research I came to find out that this solution that was getting labeled was a solution that was getting labeled multiple times a day on two separate build servers. We have a common source solution that is shared among many applications (such as security objects, loggers, etc). So while I cleared the label on the one build server, there was still a label that might have been newer on the new build server.
In order to get around this, I had to clear all the labels for that file. Normally this is not something I’d ever want to do, but fortunately this file only had about 4 labels applied to it as it was fairly new and we were not doing anything with those said labels (just cc.net labels). After removing the labels, everything started building just fine.
Coach Factory Outlet says
http://www.buycoachfactoryoutlet.net Coach Factory Outlet
Coach Factory Outlet says
http://buycoachfactoryoutletsz.com