|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
Using JScript.NET to implement a functionHello,
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 _______________________________________________ NAnt-users mailing list NAnt-users@... https://lists.sourceforge.net/lists/listinfo/nant-users |
|
|
Re: Using JScript.NET to implement a function> 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@... https://lists.sourceforge.net/lists/listinfo/nant-users |
|
|
Re: Using JScript.NET to implement a functionBob Archer wrote:
>> 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 > > > 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 BUILD FAILED C:\hp\Scripts\a.build(7,3): Compilation failed: C:\Documents and Settings\mike\Local Settings\Temp\oaw_xbfp.0.js(28,3) : error JS1002: Syntax error //------------------------------------------------------------------------------ /// <autogenerated> /// This code was generated by a tool. /// Runtime Version: 2.0.50727.1433 /// /// Changes to this file may cause incorrect behavior and will be lost if /// the code is regenerated. /// </autogenerated> //------------------------------------------------------------------------------ //@cc_on //@set @debug(off) import System; import System.Collections; import System.Collections.Specialized; import System.IO; import System.Text; import System.Text.RegularExpressions; import NAnt.Core; import NAnt.Core.Attributes; public FunctionSet("script", "script") class nant7f8689ee26f04ddb9472f9b5a112bd8c extends NAnt.Core.FunctionSetBase { [Function("testfunc")] public function testfunc():String { return ("Hello World from JS"); } public function nant7f8689ee26f04ddb9472f9b5a112bd8c(project : NAnt.Core.Project, propDict : NAnt.Core.PropertyDictionary) { super(project, propDict); } } Total time: 0.4 seconds. ------------------------------------------------------------------------------ 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@... https://lists.sourceforge.net/lists/listinfo/nant-users |
|
|
Re: Using JScript.NET to implement a function> Bob Archer wrote:
> >> 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 > > > > > > > Yes, that's what I thought. When I add that line, 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 > > > BUILD FAILED > > C:\hp\Scripts\a.build(7,3): > Compilation failed: > C:\Documents and Settings\mike\Local Settings\Temp\oaw_xbfp.0.js(28,3) > : > error JS1002: Syntax error > //--------------------------------------------------------------------- > --------- > /// <autogenerated> > /// This code was generated by a tool. > /// Runtime Version: 2.0.50727.1433 > /// > /// Changes to this file may cause incorrect behavior and will be > lost if > /// the code is regenerated. > /// </autogenerated> > //--------------------------------------------------------------------- > --------- > > //@cc_on > //@set @debug(off) > > import System; > import System.Collections; > import System.Collections.Specialized; > import System.IO; > import System.Text; > import System.Text.RegularExpressions; > import NAnt.Core; > import NAnt.Core.Attributes; > > > public FunctionSet("script", "script") > class nant7f8689ee26f04ddb9472f9b5a112bd8c extends > NAnt.Core.FunctionSetBase { > > > [Function("testfunc")] > public function testfunc():String > { > return ("Hello World from JS"); > } > > > public function nant7f8689ee26f04ddb9472f9b5a112bd8c(project : > NAnt.Core.Project, propDict : NAnt.Core.PropertyDictionary) { > super(project, propDict); > } > } > Hmm... I use C#. How complex if the function you want to write? Is there a reason you can use C#? 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@... https://lists.sourceforge.net/lists/listinfo/nant-users |
|
|
Re: Using JScript.NET to implement a functionBob Archer wrote:
>> Bob Archer wrote: >> >>>> 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 >>> >>> >>> >>> >> Yes, that's what I thought. When I add that line, 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 >> >> >> BUILD FAILED >> >> C:\hp\Scripts\a.build(7,3): >> Compilation failed: >> C:\Documents and Settings\mike\Local Settings\Temp\oaw_xbfp.0.js(28,3) >> : >> error JS1002: Syntax error >> //--------------------------------------------------------------------- >> --------- >> /// <autogenerated> >> /// This code was generated by a tool. >> /// Runtime Version: 2.0.50727.1433 >> /// >> /// Changes to this file may cause incorrect behavior and will be >> lost if >> /// the code is regenerated. >> /// </autogenerated> >> //--------------------------------------------------------------------- >> --------- >> >> //@cc_on >> //@set @debug(off) >> >> import System; >> import System.Collections; >> import System.Collections.Specialized; >> import System.IO; >> import System.Text; >> import System.Text.RegularExpressions; >> import NAnt.Core; >> import NAnt.Core.Attributes; >> >> >> public FunctionSet("script", "script") >> class nant7f8689ee26f04ddb9472f9b5a112bd8c extends >> NAnt.Core.FunctionSetBase { >> >> >> [Function("testfunc")] >> public function testfunc():String >> { >> return ("Hello World from JS"); >> } >> >> >> public function nant7f8689ee26f04ddb9472f9b5a112bd8c(project : >> NAnt.Core.Project, propDict : NAnt.Core.PropertyDictionary) { >> super(project, propDict); >> } >> } >> >> > > Hmm... I use C#. How complex if the function you want to write? Is there a reason you can use C#? > > BOb > is supposed to be supported, right? ------------------------------------------------------------------------------ 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@... https://lists.sourceforge.net/lists/listinfo/nant-users |
|
|
Re: Using JScript.NET to implement a function> > Hmm... I use C#. How complex if the function you want to write? Is > there a reason you can use C#? > > > > BOb > > > OK, I was hoping to use a language that I already know. And > JScript.NET > is supposed to be supported, right? I guess so. But since I have never used it I can't help you. Perhaps Gert or someone else can chime in with a solution. There must be a way when using JS to specify the function name to create. The other way is rather than creating a function just inline it, make it a target. Of course, if you want to use the output in expressions this doesn't help. 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@... https://lists.sourceforge.net/lists/listinfo/nant-users |
| Free embeddable forum powered by Nabble | Forum Help |