开发者

NAnt IF task doesn't seem to work

开发者 https://www.devze.com 2023-02-07 07:30 出处:网络
I\'m trying the example from the NAnt documentation for the if task at: http://nant.sourceforge.net/release/0.85/help/tasks/if.html

I'm trying the example from the NAnt documentation for the if task at:

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

Specifically the following code...

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

where build.configuration has been defined beforehand as

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

When I run it using nant.exe (version 0.91.3881.0), I get the following error:

'}' e开发者_如何学运维xpected
Expression: ${build.configuration='release'}
                                 ^

I'm guessing I'm missing something simple?


You need to double the = symbol as per your web page.

When programming, = is an assignment operator in most languages, whereas == is the boolean comparison operator.


Maybe the NAnt reference should be changed then....

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

See the manual.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号