(This works for other people in my team, so it is likely to be something to do with the setup of my machine.)
I am using the NUnit GUI test runner. When I use File/Open Project to load the test's assembly, I get an error.
The project was built with Visual Studio 2005 and Visual Studio’s About box gives the .NET framework version as 2.0.50727 SP2.
This is the error I get:
Assembly Not Loaded
System.BadImageFormatException : Could
not load file or assembly 'Tests,
Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null' or one of its
dependencies. An attempt was made to
load a program with an incorrect
format. You may be attempting to load
an assembly built with a later version
of the CLR than the version under
which NUnit is currently running
(2.0.50727) or trying to load a
64-bit assembly into a 32-bit process.
I have just used Assembly Binding Log Viewer (Fuslogvw.exe) to look at the fusions log, this is what is shows me, that does not make any sence, as I told it to look at all binds.
*** Assembly Binder Log Entry (05/11/2010 @ 11:55:26) ***
The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.
Assembly manager loaded from: C:WindowsMicrosoft.NETFramework64v2.0.50727mscorwks.dll
Running under executable C:Program Files (x86)NUnit 2.5.7in
et-2.0
unit.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = KSSRETAILian.ringrose
LOG: DisplayName = System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
(Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/NUnit 2.5.7/bin/net-2.0/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = nunit.exe
Calling assembly : nunit-gui-runner, Version=2.5.7.10213, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:Program Files (x86)NUnit 2.5.7in
et-2.0
unit.exe.config
LOG: Using machine configuration file from C:WindowsMicrosoft.NETFramework64v2.0.50727configmachine.config.
LOG: Post-policy reference: System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
LOG: Reusing an assembly instance that was previously loaded (C:WindowsassemblyGAC_MSILSystem.Windows.Forms2.0.0.0__b77a5c561934e089System.Windows.Forms.dll).
Thanks to Lasse pointing me in the right direction. When I run nunit-x86.exe, I can load the test DLL. Therefore there must be a 32-bit DLL somewhere in the system.
However I still don't know how to get a useful set of logs to track down this type of problem in a logical way.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…