Cruisecontrol task with can execute even if Soursecontrol is not accessible

268 views Asked by At

I have deployed CruiseControl.Net (Version 1.6.7981.1) server and it does the following tasks:

  1. Build trigger
  2. Labeller
  3. VSTS Soursecontrol block (Get the soursecode from TFS 2010 server)
  4. Build the code in Debug mode
  5. Run NUnit test using Nanat task
  6. Merge NUnit-Result.xml (Publisher task)

As I need to clear NUnit-Result.xml file every time before running the NUnit task, I have added a delete task in Nant.build file which deletes NUnit-results.xml before NUnit task run.

Now my problem is when my build get triggers and if my TFS server is not accessible, build get failed and only publisher task runs so Old Nunit result file merge in the failed build.

I Tried running "Prebuild" task but it works only if TFS server is accessible.

Now What I want is a task to delete Nunit-result.xml which can run even if my TFS is not accessible (either before soursecontrol block or within/after publisher block)

Thanks in advance

3

There are 3 answers

0
Flemming Christensen On

You can add an exec task to delete the file in the publisers setion just before the file merge

Like this:

<publishers>
  <xmllogger />
  <statistics />
  <buildpublisher>
    <sourceDir>$(buildDir)\_PublishedWebsites\$(projectName)</sourceDir>
    <publishDir>$(webDir)</publishDir>
    <useLabelSubDirectory>false</useLabelSubDirectory>
    <alwaysPublish>false</alwaysPublish>
  </buildpublisher>
  <exec>
    <executable>$(workingDir)\deleteNunitResultxml.cmd</executable>
  </exec>
   ...
</publishers>
0
Adam Bruss On

Have a publisher at the end which moves the nunit result file or deletes it. Then it won't be there for the next build.

0
Simon Laing On

Another option is to create a task to run before the nunit task runs, which deletes the nunit-result.xml file.

E.g. execute cmd /c "del NUnit-Result.xml"