Re: Fwd: CLR4/CLR2 NUnit binding

Ryan Boggs <[email protected]> Fri, 1 Jun 2012 07:29:34 -0700
Newsgroups gmane.comp.windows.dotnet.nant.devel
Message-ID <CAJg1EnAkg8LRZC14N40wZ5gERi9OH2LRrTgYsO_2j6J0nkhQOQ@mail.gmail.com>
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=3D"v4.0.30319" />

Hope this info is helpful.

Thanks,
Ryan

On Fri, Jun 1, 2012 at 3:16 AM, Richard Birkby <[email protected]> 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:
>
> =A0 =A0[nunit2] Test Fixture SetUp Failures:
> =A0 =A0[nunit2] 1) AlerterTests : SetUp : System.IO.FileLoadException : M=
ixed
> mode assembly is built against version 'v2.0.50727' of the runtime and
> cannot be loaded in the 4.0 run...
> =A0 =A0[nunit2] at System.Reflection.RuntimeAssembly.GetType(RuntimeAssem=
bly
> assembly, String name, Boolean throwOnError, Boolean ignoreCase,
> ObjectHandleOnStack type)
> =A0 =A0[nunit2] at System.Reflection.RuntimeAssembly.GetType(String name,
> Boolean throwOnError, Boolean ignoreCase)
> =A0 =A0[nunit2] at System.Reflection.Assembly.GetType(String name, Boolean
> throwOnError)
> =A0 =A0[nunit2] at
> Microsoft.SqlServer.Management.Common.ServerConnection.GetStatements(Stri=
ng
> query, ExecutionTypes executionType, Int32& statementsToReverse)
> =A0 =A0[nunit2] at
> Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(St=
ring
> 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 <[email protected]>
> Date: Mon, Oct 24, 2011 at 9:51 AM
> Subject: CLR4/CLR2 NUnit binding
> To: [email protected]
>
>
> 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 a=
s:
>
> =A0: System.IO.FileLoadException : Mixed mode assembly=A0is built against
> version 'v2.0.50727' of the runtime and cannot be loaded in the=A04.0 run=
time
> without additional configuration information.
>
> It appears from ildasm that Nant correctly built my assemblies against .N=
et
> 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 t=
he
> 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
> [email protected]
> 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/