Re: c# compiler selection for the <script> task
"Gert Driesen" <[email protected]>
| Newsgroups | gmane.comp.windows.dotnet.nant.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Liam, We use CodeDOM to compile the script, and hence it uses the C# compiler corresponding to the CLR on which NAnt is running. The current target framework - as specified using the nant.settings.currentframework - does not affect this. I'd appreciate it if you'd submit a (documentation) bug report for this. Hope this helps, Gert From: [email protected] [mailto:[email protected]] Sent: donderdag 21 oktober 2010 21:09 To: keht Cc: [email protected] Subject: Re: [NAnt-users] c# compiler selection for the <script> task yeah, that is odd. I cannot get var to work. I changed my .config file settings as well to point to 3.5, but still getting an error. From: keht <[email protected]> To: [email protected] Cc: [email protected] Date: 10/21/2010 09:49 AM Subject: Re: [NAnt-users] c# compiler selection for the <script> task _____ Sorry for unclear explanations... For example, this code returns an error: <project name="Test" default="run"> <property name="nant.settings.currentframework" value="net-3.5" /> <target name="run"> <script language="C#" mainclass="Test"> <code> <![CDATA[ class Test { public static void ScriptMain(Project project) { var s = "Hello world"; Console.WriteLine(s); } } ]]> </code> </script> </target> </project> Buildfile: file:///c:/_nant-0.91-alpha2/examples/ScriptTask/script-sample.build <file:///c:\_nant-0.91-alpha2\examples\ScriptTask\script-sample.build> Target framework: Microsoft .NET Framework 3.5 Target(s) specified: run run: BUILD FAILED c:\_nant-0.91-alpha2\examples\ScriptTask\script-sample.build(4,10): Compilation failed: [...]\Temp\h7ph1r09.0.cs(27,29) : error CS0246: The type or namespace name 'var' could not be found[...] I don't understand why it happens. Framework is changed to 3.5 but script code is compiled using csc v2.0. ---- Regards, keht On Thu, Oct 21, 2010 at 16:02, <[email protected]> wrote: I am not exactly sure what you are asking, as your post is a bit unclear. if you want to use C# 3 features in your app, make sure you have the proper version installed and your app is referencing them. In addition, this listserv is not the proper place to post this question. if you want Nant to reference a version of the framework that uses C#3 and allows the var keyword, make sure you are referencing the correct framework in your Nant.exe,.config file in your bin directory. LK From: keht < <mailto:[email protected]> [email protected]> To: <mailto:[email protected]> [email protected] Date: 10/21/2010 08:46 AM Subject: [NAnt-users] c# compiler selection for the <script> task _____ Hi all, I want to use c# 3.0 features ("var" keyword, for example). But if I use it in the <script language="c#"> task then I got compilation error. How I can select c# compiler version there? Thanks in advance! -- View this message in context: <http://old.nabble.com/c--compiler-selection-for-the-%3Cscript%3E-task-tp300 19135p30019135.html> http://old.nabble.com/c--compiler-selection-for-the-%3Cscript%3E-task-tp3001 9135p30019135.html Sent from the NAnt - Users mailing list archive at Nabble.com. ---------------------------------------------------------------------------- -- Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store <http://p.sf.net/sfu/nokia-dev2dev> http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ NAnt-users mailing list <mailto:[email protected]> [email protected] <https://lists.sourceforge.net/lists/listinfo/nant-users> https://lists.sourceforge.net/lists/listinfo/nant-users The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please delete the material from any computer. ---------------------------------------------------------------------------- -- Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store <http://p.sf.net/sfu/nokia-dev2dev> http://p.sf.net/sfu/nokia-dev2dev___________________________________________ ____ NAnt-users mailing list [email protected] <https://lists.sourceforge.net/lists/listinfo/nant-users> https://lists.sourceforge.net/lists/listinfo/nant-users The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please delete the material from any computer. No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.856 / Virus Database: 271.1.1/3210 - Release Date: 10/21/10 08:34:00 ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ NAnt-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nant-users