Using JScript.NET to implement a function

Mike Frederick <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nant.user
Message-ID <[email protected]>
Hello,

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()}
              ^^^^^^^^^^^^^^^^^

Total time: 0.4 seconds.

even though it sure looks like I have defined the function "testfunc".  
Anybody have any pointers?

------------------------------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.