Hi,

That's because the nunit2 is running on the framework that NAnt is
currently running on.  Which is the highest version of the .NET
framework found on your machine.  I see that you have two options.

1) Compile your project on 4.0
or
2) If you must compile your project on 3.5, then you could edit the
NAnt.exe.config to not run on 4.0 by removing/commenting out the
element listed below at the bottom of the file.  Please be advised
that this may also have unforeseen side-effects when running NAnt.
Thus, I do not recommend this course of action.

Xml Element to delete/comment in NAnt.exe.config:
<supportedRuntime version="v4.0.30319" />

Hope this info is helpful.

Thanks,
Ryan

On Fri, Jun 1, 2012 at 3:16 AM, Richard Birkby <rbir...@gmail.com> wrote:
> Hi
>
> I didn't get a reply to this question on nant-users.
> I want my nant script to run NUnit (<nunit2>) under .Net 3.5 - it runs
> everything else (eg <msbuild>) correctly when I specify a target framework
> of net-3.5.
> But NUnit seems to be run as .Net 4 and consequently I get the following
> errors:
>
>    [nunit2] Test Fixture SetUp Failures:
>    [nunit2] 1) AlerterTests : SetUp : System.IO.FileLoadException : Mixed
> mode assembly is built against version 'v2.0.50727' of the runtime and
> cannot be loaded in the 4.0 run...
>    [nunit2] at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly
> assembly, String name, Boolean throwOnError, Boolean ignoreCase,
> ObjectHandleOnStack type)
>    [nunit2] at System.Reflection.RuntimeAssembly.GetType(String name,
> Boolean throwOnError, Boolean ignoreCase)
>    [nunit2] at System.Reflection.Assembly.GetType(String name, Boolean
> throwOnError)
>    [nunit2] at
> Microsoft.SqlServer.Management.Common.ServerConnection.GetStatements(String
> query, ExecutionTypes executionType, Int32& statementsToReverse)
>    [nunit2] at
> Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String
> sqlCommand, ExecutionTypes executionType)
>
>
> I still get this problem with 0.92rc1. What can I do about it?
> Is this because <msbuild> is run as a different process, whereas <nunit2> is
> run in the same process as Nant?
>
>
> Thanks,
> Richard
>
>
> ---------- Forwarded message ----------
> From: Richard Birkby <rbir...@gmail.com>
> Date: Mon, Oct 24, 2011 at 9:51 AM
> Subject: CLR4/CLR2 NUnit binding
> To: nant-us...@lists.sourceforge.net
>
>
> Hi,
>
> I've tried to upgrade our Nant 0.90 to Nant 0.91 this morning. Everything
> went well apart from the test phase where NUnit failed with errors such as:
>
>  : System.IO.FileLoadException : Mixed mode assembly is built against
> version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime
> without additional configuration information.
>
> It appears from ildasm that Nant correctly built my assemblies against .Net
> 3.5, however when it starts running the nunit2 task, it thinks it should run
> it as .Net 4.
>
> What should I do to tell it to run it as .Net 3.5?
>
>
> Thanks,
> Richard
> ps There is a small possibility I corrupted the merge of Nant 0.91 into the
> existing structure. Could this be the reason?
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> nant-developers mailing list
> nant-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nant-developers
>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
nant-developers mailing list
nant-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to