tags:

views:

58

answers:

1

Hi, I am using pnunit to run nunit tests on remote machines, the pnunit agent loads the test and runs it in Windows 2008 but the test fails to load in Windows 2003, the agent error is

INFO  PNUnit.Agent.PNUnitAgent - Registering channel on port 9080
INFO  PNUnit.Agent.PNUnitAgent - RunTest called for Test MyTest, AssemblyName test.dll, TestToRun test.Program.myDeployTest
INFO  PNUnit.Agent.PNUnitTestRunner - Spawning a new thread
INFO  PNUnit.Agent.PNUnitTestRunner - Thread entered for Test MyTest:test.Program.myDeployTest Assembly test.dll

Unhandled Exception: System.BadImageFormatException: The format of the file 'test
' is invalid.
File name: "test"

Server stack trace:
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, B
oolean isStringized, Evidence assemblySecurity, Boolean throwOnFileNotFound, Ass
embly locationHint, StackCrawlMark& stackMark)

On running procmon and monitoring the agent process i could see that the agent executable was using .NET 1.1 assemblies on Windows 2003 and .NET 2.0 on Windows 2008 which could be an explanation for this behavior. How do I get the agent to use .NET 2.0 on Windows 2003? I am using Visual Studio 2005 to create the tests.

A: 

Create a .config file for the application and insert/merge the following (of course with the version you want, this is for 2.0 RTM):

<configuration>
  <startup>
    <supportedRuntime version="v2.0.50727"/>
    <requiredRuntime version="v2.0.50727" safemode="true"/>
  </startup>
</configuration>

This for instance will load .NET 2 even for a 1.1 application or if a unmanaged application activates a 1.1 COM object.

Lucero
Thank you, that worked
HN