ItemExistsException

We were using CrusieControl for doing our nightly build. we were able to get the latest source
code from the repository build it, run unit tests, code coverage, complexity and all the good
things .. Everything seemed to work great until one day we had the folllowing exception

Microsoft.TeamFoundation.VersionControl.Client.ItemExistsException: 
The item $/ProjectDirectory/SerializableDictionary.cs already exists. --->
System.Web.Services.Protocols.SoapException:
The item $/Project/SerializableDictionary.cs already exists.
--- End of inner exception stack trace ---

After breaking my head for almost 2 hours I found out that the problem causing
 the exception was because of the following element in our config file

<sourcecontrol  autoGetSource="true" applyLabel="true" type="vsts">
                     <server>http://10.0.0.8:8080</server>
                      <project>$/Broad Institute</project>
                     <deleteWorkspace>false</deleteWorkspace>
                     <workingDirectory>C:\broad-ccnet</workingDirectory>
</sourcecontrol>
This is  the "sourceControl" block written for TFS in CruiseControl. 


This is what had happened:
• The SerializableDictionary .cs was moved to a different project
• For some reason, when you have applyLabel to “true” it messes
        up the way things are maintained internally inside TFS when you move an item.
• So when you get the latest version, TFS thinks that the old file is there
        and throws the “ItemExistsException”

To Solve this I had to do the following
 * Use tfs from the commandline to unlabel the file. The following commands were used
 * I used the history command to track the changes to SerializableDictionary.cs
 * tf labels /server:10.0.1.23
   Displays all the labels
 * tf label 30 /delete  /server: 10.0.1.23
   Remove the label that you want to remove
 * Change the applyLabel="false"

More info on the commands can be found at MSDN


Everything was back to normal again
Hope this helps someone!

 

What did you think of this article?




Trackbacks
  • No trackbacks exist for this post.
Comments
  • No comments exist for this post.
Leave a comment

Submitted comments are subject to moderation before being displayed.

 Enter the above security code (required)

 Name

 Email (will not be published)

 Website

Your comment is 0 characters limited to 3000 characters.