CCNet TFS Migration - Dealing with left over folders

Posted by Michael Stephenson on Geeks with Blogs See other posts from Geeks with Blogs or by Michael Stephenson
Published on Fri, 28 Jan 2011 23:30:32 GMT Indexed on 2011/01/29 7:27 UTC
Read the original article Hit count: 534

Filed under:

Im currently in the process of migrating our many BizTalk projects from MKS source control to TFS.  While we will be using TFS for work item tracking and source control etc we will be continuing to use Cruise Control for continuous integration although im updating this to CCNet 1.5 at the same time.

Ill post a few things as much as a reminder to myself about some of the problems we come across.

Problem

After the first build of our code the next time a build is triggered an error is encountered by the TFS source control block refreshing the source code.

System.IO.IOException: The directory is not empty.

   at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive)
   at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive)
   at ThoughtWorks.CruiseControl.Core.Sourcecontrol.Vsts.deleteDirectory(String path)
   at ThoughtWorks.CruiseControl.Core.Sourcecontrol.Vsts.GetSource(IIntegrationResult result)
   at ThoughtWorks.CruiseControl.Core.IntegrationRunner.Build(IIntegrationResult result)
   at ThoughtWorks.CruiseControl.Core.IntegrationRunner.Integrate(IntegrationRequest request)

System.IO.IOException: The directory is not empty. at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive) at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive) at ThoughtWorks.CruiseControl.Core.Sourcecontrol.Vsts.deleteDirectory(String path) at ThoughtWorks.CruiseControl.Core.Sourcecontrol.Vsts.GetSource(IIntegrationResult result) at ThoughtWorks.CruiseControl.Core.IntegrationRunner.Build(IIntegrationResult result) at ThoughtWorks.CruiseControl.Core.IntegrationRunner.Integrate(IntegrationRequest request)
Project: Bupa.BPI.Documents
Date of build: 2011-01-28 14:54:21
Running time: 00:00:05
Integration Request: Build (ForceBuild) triggered from VMOPBZDEV11

Solution

The problem seems to be with a folder called TestLocations which is created by the build process and used along with the file adapter as a way to get messages into BizTalk.  For some reason the source control block when it does a full refresh of the code does not get rid of this folder and then complains thats a problem and fails the build.

Interestingly there are other folders created by the build which are deleted fine.  My assumption is that this if something to do with the file adapter polling the directory.  However note that we have not had this problem with other source control blocks in the past.

To workaround this I have added a prebuild task to the ccnet.config file to delete this folder before the source control block is executed.  See below for example

<

prebuild> exec>executable>cmd.exe</executable>buildArgs>/c "if exist "C:\<MyCode>\TestLocations" rd /s /q "C:\<MyCode>\TestLocations""</buildArgs>exec> prebuild>

<

<

<

</

</

© Geeks with Blogs or respective owner