> I am very familiar with JScript, but not with JScript.NET or C#.  I
> want
> to write a function in JScript.NET that I can use in my NAnt script.
> 
> I currently have:
> 
> <project name="TestFunction">
> 
>     <target name="go"><echo>${script::testfunc()}</echo></target>
> 
>     <script language="JS">
>         <code>
>         <![CDATA[
>         public function testfunc():String { return ("Hello World from
> JS"); }
>         ]]>
>         </code>
>     </script>
> </project>
> 
> But when I run this I get:
> 
> C:\hp\Scripts>nant -f:a.build go
> NAnt 0.86 (Build 0.86.2898.0; beta1; 12/8/2007)
> Copyright (C) 2001-2007 Gerry Shaw
> http://nant.sourceforge.net
> 
> Buildfile: file:///C:/hp/Scripts/a.build
> Target framework: Microsoft .NET Framework 3.5
> Target(s) specified: go
> 
>    [script] Scanning assembly "l-qhzdpm" for extensions.
> 
> go:
> 
> 
> BUILD FAILED
> 
> C:\hp\Scripts\a.build(4,4):
> Unknown function 'script::testfunc'.
> Expression: ${script::testfunc()}

I'm not sure but you may have to annotate the function name:

[Function("testfunc")]

at the top of your script. 

BOb

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to