Another day

Finally we start adding release task into our, it becomes a challenge to spilt our huge single assembly into different parts like the way they should be. After google a while, I’m still not buying the idea of enable NUnit loading multiple test assemblies, as described here and here. I’m not trying to avoid the merging task in cc.config, but it’s unnecessary, and JP’s merging solution works totally fine for this, except for release purpose.

Until now, the <solution> task in the latest (0,86-beta1) NAnt still doesn’t support 2008 solution build file, thanks to this post, I managed to set up an exec task to call MSBuild the 2008 solution.

I had to remove the /t:Clean from the example code, nothing will be generated with this switch.

Something I should have done long time ago is, to add ‘’ file into solution folder, editing xml file in VS and checking it in, then automatically pick it up… Wow! It just is a charm.

A piece of my new

  <target name="default" depends="cleanUpTestResult, compileDebug, test, compileRelease" />

  <target name="cleanUpTestResult" description="remove recent test results.  ">
    <delete failonerror="false">
      <!-- this prevents unit test results from appearing in cc console if the build fails -->
        <include name="TestResults*" />

  <target name="compileDebug">
    <!-- Build a single huge assembly for Nunit.
    don't know the easy way to enable Nunit take multi-assembly yet.-->
    <csc output="${compile.dir}\${currentproject.lib}.dll" target="library" rebuild="true" debug="true">
      <sources refid="project.lib.references" />
      <references refid="deploy.lib.fileset"/>

  <target name="compileRelease">

    <exec program="c:\windows\microsoft.NET\Framework\v3.5\msbuild.exe"
            commandline="${base.dir}\${project::get-name()}.sln /p:Configuration=release"

     <call target="deploy" />
  <target name="deploy"   >
    <delete dir="${dist.dir}" />
    <mkdir dir="${dist.dir}" />
    <copy todir="${dist.dir}" flatten="true" >
      <fileset basedir="${app.src.dir}">
        <include name="**\our*.dll" />
        <include name="**\our*.pdb" />
  <target name="test" description="runs the unit tests" >
    <!-- Unit Test Assembly -->
    <exec program="${path.nunit.console}\NUnit-Console.exe" basedir="${compile.dir}\">
      <arg value="${compile.dir}\${currentproject.lib}.dll" />

  <!-- Source code deleted from vss won't be deleted from folder, had to do it before each build.
       This task is called by cruisecontrol, inside ccnet.config.
  <target name="clean.up">
    <delete dir="${src.dir}" />


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s