[ nant-Bugs-3095656 ] Issue Specifying Compiling Framework

"SourceForge.net" <[email protected]> Thu, 5 May 2011 12:21:35 -0700
Newsgroups gmane.comp.windows.dotnet.nant.devel
Message-ID <[email protected]>
Bugs item #3095656, was opened at 2010-10-26 07:19
Message generated for change (Comment added) made by rmboggs
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=402868&aid=3095656&group_id=31650

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core
Group: None
Status: Open
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: Liam Kenny (panamared)
Assigned to: Nobody/Anonymous (nobody)
Summary: Issue Specifying Compiling Framework

Initial Comment:
We encountered this issue when trying to execute code within the script tag.  nant.settings.currentframework was set to net-3.5 in both the build file and the Nant.exe.config file, but it was still compiled in the 2.0 Framework.

According to Gert: "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."

My sample build-file is below:

<?xml version="1.0"?>
<project name="Test" default="run" basedir=".">
	<description></description>  
	<property name="debug" value="true"/>
	<property name="nant.settings.currentframework" value="net-3.5" />
	<target name="run">
		<script language="c#">
		    <code>
				<![CDATA[
              		public static void ScriptMain(Project project) 
              		{
              			string str = "Hello World from Nant C#; Version ";
              			string ver = System.Environment.Version.ToString();
                  		project.Log(Level.Info, str.ToString() + ver);
              		}
           		]]>
		    </code>
	    </script>
	</target>
</project>

----------------------------------------------------------------------

>Comment By: Ryan Boggs (rmboggs)
Date: 2011-05-05 12:21

Message:
If I am not mistaken, .net 3.5 is built upon the 2.0 clr.  Thus, the
System.Environment.Version will always spit out 2.0 when the target frame
work is net-2.0, 3.0, or 3.5.  So chances are, that code is running on
3.5.

Have you tried your code in a simple console project?  What does that
output say?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=402868&aid=3095656&group_id=31650

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
nant-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-developers