Is it possible to send parameters into Nant task?

大城市里の小女人 提交于 2019-12-08 13:04:18

问题


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.


回答1:


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>



回答2:


What version of CCNet are you using?

Version 1.5 has the ability to pass parameters down to NAnt and seems to work quite well.



来源:https://stackoverflow.com/questions/3335698/is-it-possible-to-send-parameters-into-nant-task

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!