【发布时间】:2017-11-17 15:53:32
【问题描述】:
对于构建脚本,我的部分流程是使用内部可执行文件部署文件。我们用一些参数来调用它。
在我正在开发的应用程序中,我们需要添加一个参数。这不是追溯适用于我之前从事的任何其他工作的东西,因此我的想法是,如果相应的属性不为 null 或为空,我只会包含新参数。
相关的 NAnt 调用:
<property name="deploy.NewArg" value="" />
<echo message="deploy.NewArg = ${deploy.NewArg}" />
<exec program="C:\Deploy\MyAwesomeDeployProgram.exe">
<arg value="AppTitle=${deploy.AppTitle}" />
<arg value="Environment=${deploy.Environment}" />
<!-- Here's the problem argument... -->
<arg value="MyNewProperty=${deploy.NewArg}" if="${deploy.NewArg}" />
</exec>
我所拥有的不起作用的原因是因为新 <arg> 标记上的 if 子句 - deploy.NewArg 字符串不会转换为布尔语句。
问题:我可以通过什么方式对<arg if> 参数执行“是空还是空”检查?如上所述,如果 deploy.NewArg 不是任何内容或空字符串,我希望添加 MyNewProperty=... 参数。
我检查了许多其他 StackOverflow 问题以及 official NAnt arg tag documentation,但找不到如何执行此操作。
【问题讨论】:
标签: conditional nant isnullorempty