Search code examples
cruisecontrol.netnant

Is it possible to send parameters into Nant task?


I would like to have a nant task which builds code into either a dev/test folder depending on the type of build. Rather than have repeated tasks/targets with just different folders I would like to call Nant task from CruiseControl.NET with a different parameter dev / test.

The nant task would then define a property for the output folder depending on the input parameter. I think I needs some kind of 'if' statement to test the parameter and define the correct one.

Any ideas how to do this? Thanks.


Solution

  • Typing:

    nant -help
    

    shows that you can define properties as follows:

    -D:name=value
    

    to test it in a script:

    if="${property:exists('name')}"
    

    in CCNet, you can run it with:

    <tasks>
     <nant>
      <executable>nant.exe</executable>
      <buildFile>script.build</buildFile>
      <targetList>
       <target>build</target>
      </targetList>
      <buildArgs>-D:defaultPath=C:\build</buildArgs>
      <buildTimeoutSeconds>600</buildTimeoutSeconds>
     </nant>
    </tasks>