goombaloon
goombaloon

Reputation: 3099

NAnt IF task doesn't seem to work

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:

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

I'm guessing I'm missing something simple?

Upvotes: 2

Views: 1504

Answers (2)

Dave
Dave

Reputation: 21

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

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

See the manual.

Upvotes: 2

Benoit
Benoit

Reputation: 79235

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.

Upvotes: 3

Related Questions