是否可以将参数发送到Nant任务中? [英] Is it possible to send parameters into Nant task?

查看:68
本文介绍了是否可以将参数发送到Nant任务中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个nant任务,根据构建类型将代码构建到dev/test文件夹中.与其使用不同的文件夹重复执行任务/目标,我不希望使用不同的参数dev/test从CruiseControl.NET调用Nant任务.

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.

然后,nant任务将根据输入参数为输出文件夹定义一个属性.我想我需要某种"if"语句来测试参数并定义正确的参数.

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.

推荐答案

键入:

nant -help

显示您可以如下定义属性:

shows that you can define properties as follows:

-D:name=value

在脚本中对其进行测试:

to test it in a script:

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

在CCNet中,您可以使用以下命令运行它:

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>

这篇关于是否可以将参数发送到Nant任务中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆