Hi there, it looks like your second variable should be referenced as a property, so something like the following should work:

<!-- nant version 0.85.1642.0 -- >

<!-- to set property -->

<property name="s2build01" value="${environment::get-variable('BUILD')}"/>

<!-- to call in .build -- >

<if test=”${s2build01}” >

</if>


Kevin Kirkpatrick wrote:

Thanks Bill and Merrill for your responses.

I tried putting quotes around the variable ‘build’ and got the following error.

Secondly, does anyone know where to find better documentation/help?

<property name="s2build01" value="${environment::get-variable('BUILD')}"/>

-------

D:\XPM\3.0\src\Esurance>nant target

NAnt 0.85 (Build 0.85.1642.0; net-1.1.win32; nightly; 6/30/2004)

Copyright (C) 2001-2004 Gerry Shaw

NAnt Team

Buildfile: file:///D:/XPM/3.0/src/xpm.build

Target(s) specified: target

init:

[tstamp] Monday, June 06, 2005 2:12:59 PM.

target:

BUILD FAILED

INTERNAL ERROR

System.FormatException: String was not recognized as a valid Boolean.

at System.Boolean.Parse(String value)

at System.Convert.ToBoolean(String value)

at NAnt.Core.Tasks.IfTask.get_ConditionsTrue() in d:\nant\src\NAnt.Core\Tasks\IfTask.cs:line 271

at NAnt.Core.Tasks.IfNotTask.get_ConditionsTrue() in d:\nant\src\NAnt.Core\Tasks\IfTask.cs:line 390

at NAnt.Core.Tasks.IfTask.ExecuteTask() in d:\nant\src\NAnt.Core\Tasks\IfTask.cs:line 333

at NAnt.Core.Task.Execute() in d:\nant\src\NAnt.Core\Task.cs:line 176

at NAnt.Core.Target.Execute() in d:\nant\src\NAnt.Core\Target.cs:line 249

at NAnt.Core.Project.Execute(String targetName, Boolean forceDependencies) in d:\nant\src\NAnt.Core\Project.cs:line 870

at NAnt.Core.Project.Execute() in d:\nant\src\NAnt.Core\Project.cs:line 827

at NAnt.Core.Project.Run() in d:\nant\src\NAnt.Core\Project.cs:line 895

Please send bug report to [EMAIL PROTECTED]

Total time: 1.1 seconds.

D:\XPM\3.0\src\>

-----Original Message-----
*From:* Bill Martin [mailto:[EMAIL PROTECTED]
*Sent:* Monday, June 06, 2005 2:08 PM
*To:* Kevin Kirkpatrick; nant-users@lists.sourceforge.net
*Subject:* RE: [Nant-users] environment::get-variable usage

You need single quotes round the variable name, otherwise NAnt will try to evaluate it as a property:

<property name="s2build01" value="${environment::get-variable('BUILD')}" />

I'm pretty sure that the environment variable lookup is not case sensitive so 'BUILD' and 'build' should both work.

HTH,

Bill

-----Original Message-----
*From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of *Kevin Kirkpatrick
*Sent:* 06 June 2005 21:57
*To:* nant-users@lists.sourceforge.net
*Subject:* [Nant-users] environment::get-variable usage

I have a really stupid question. Is the correct usage for this function, environment::get-variable?

<!-- nant version 0.85.1642.0 -- >

<!-- to set property -->

<property name="s2build01" value="${environment::get-variable(BUILD)}"/>

<!-- to call in .build -- >

<if test=”s2build01” >

</if>

Thanks.





-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to