views:

321

answers:

3

I've set up some rather large C++ projects to do integration builds in CruiseControl.NET, using MSBuild.

Now I'd like to schedule a complete Clean of the working directory once a night. How can I do that with CC.NET ?

A: 

We created a script that deletes everything in the source directory and placed it in the prebuild step:

<prebuild>
    <exec>
        <executable>Clean_Source.bat</executable>
        <baseDirectory>SourceDir</baseDirectory>
    </exec>
</prebuild>
David French
Won't that run every build ? I'd like a clean just once a night, as full builds take 10-12 minutes.
nos
It will run every build. We have two build projects that reference the same set of build parameters - an incremental build and a full build. The full build calls this prebuild step first, then the regular incremental build is called.
David French
+4  A: 

You can create a project that cleans your working directory at specified time.

<project name="CleanWorkingDir">
<triggers>
    <scheduleTrigger time="23:30" buildCondition="ForceBuild" name="Scheduled"/>
</triggers>
<tasks>
    <exec executable="c:\projects\myproject\build.bat"/>
</tasks>
</project>
Rajesh
+1  A: 

Use the clean copy on the source control block, everything is already done for you. All you have to do is set it to true. If you really just want a project to clean that directory, then don't have any build tasks. However, as a matter of good release engineering you really should use cleancopy with all your individual builds. Otherwise, you cnanot be sure the build would work on an absolutely clean machine.

Alex