NAnt IF任务似乎不起作用

时间:2011-01-26 13:20:01

标签: nant

我正在尝试NAnt文档中的 if 任务的示例:

http://nant.sourceforge.net/release/0.85/help/tasks/if.html

具体如下代码......

<if test="${build.configuration='release'}">
    <echo>Build release configuration</echo>
</if>

其中build.configuration已预先定义为

<property name="build.configuration" value="debug" overwrite="false" />

当我使用 nant.exe(版本0.91.3881.0)运行它时,出现以下错误:

'}' expected
Expression: ${build.configuration='release'}
                                 ^

我猜我错过了一些简单的东西?

2 个答案:

答案 0 :(得分:3)

您需要根据网页加倍=符号。

编程时,=是大多数语言中的赋值运算符,而==是布尔比较运算符。

答案 1 :(得分:2)

可能应该更改NAnt参考....

<if test="${build.configuration='release'}">
    <echo>Build release configuration</echo>
</if>

See the manual

相关问题