Re: c# compiler selection for the <script> task

keht <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nant.user
Message-ID <[email protected]>
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
*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 <[email protected]>
> To:        [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-tp30019135p30019135.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
> _______________________________________________
> NAnt-users mailing list
> [email protected]
> 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

_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users
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.