views:

553

answers:

3

Exception: ProcessModel: Default DomainUsage: Single Execution Runtime: net-4.0 Unhandled Exception: System.ArgumentException: The net-4.0 framework is not available Parameter name: framework at NUnit.Util.TestAgency.GetAgent(RuntimeFramework framework, Int32 waitTime, Boolean enableDebug) at NUnit.Util.ProcessRunner.Load(TestPackage package) at NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options) at NUnit.ConsoleRunner.Runner.Main(String[] args)

OS Winserver 2008 R2 x64

Nunit 2.5.4.10098

Test assembly Built for .net 4.0 RTM (v4.0.30319)

Commandline nunit-console.exe NServiceBus.Config.UnitTests.dll /framework=net-4.0

Any ideas?

A: 

I was having the same issue with CC.net.

I now run NUnit from NAnt using the arguement /framework=4.0.30319

Hope this helps

Kev

Kevin
Andreas
+6  A: 

Combine Kev's advice ( add /framework=4.0.30319 to the parameter list) and modify nunit-console.exe.config with the following:

under

 <configuration>

add:

<startup>  <requiredRuntime version="v4.0.30319" /></startup>

under <configuration><runtime> add:

 <legacyUnhandledExceptionPolicy enabled="1" />
FrederikB
That did it, thanks! Had to add: <loadFromRemoteSources enabled="true" />to the runtime section as well though!
Andreas
A: 

I'm having the same issue with NUnit 2.5.4.10098 and .NET v4.0.30319.

I followed FrederikB's advice and modified the console.exe.config file. I'm using the console runner with the framework parameter: nunit-console.exe /framework=net-4.0

Now I'm also getting this System.NullReferenceException which Andreas posted before.

System.NullReferenceException: Object reference not set to an instance of an object.

Server stack trace:
   at NUnit.Util.ProcessRunner.Load(TestPackage package)
   at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
   at NUnit.Util.RemoteTestAgent.AgentRunner.Load(TestPackage package)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

I know one way to get it running is setting the environment variable COMPLUS_Version=4.0.30319 but I can't use this approach because it leads to several other problems in our build automation tool.

Hodri