(这适用于我团队中的其他人,因此很可能与我的机器安装有关。)如何调查拒绝在NUnit中加载的测试程序集的过程?
我正在使用NUnit GUI测试运行器。当我使用File/Open Project加载测试程序集时,出现错误。
该项目是使用Visual Studio 2005和Visual Studio的About框架为.NET Framework 2.0.50727 SP2提供的。
这是错误我得到:
大会未加载
System.BadImageFormatException:难道 无法加载文件或程序集测试, 版本= 0.0.0.0,文化=中性, PublicKeyToken = null'或其 依赖项之一。试图对 加载具有不正确的 格式的程序。您可能试图加载 与CLR比版本更高 版本内置的组件 在其下的NUnit当前正在运行 (2.0.50727)或尝试一个 64位组件加载到32位处理。
我刚使用Assembly Binding Log Viewer(Fuslogvw.exe)看融合日志,这是什么,是表明我,不作任何SENCE,因为我告诉他们看看所有绑定。
*** 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:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
Running under executable C:\Program Files (x86)\NUnit 2.5.7\bin\net-2.0\nunit.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = KSSRETAIL\ian.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.7\bin\net-2.0\nunit.exe.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.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:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll).
多亏了拉塞指着我在正确的方向。当我运行nunit-x86.exe时,我可以加载测试DLL。因此系统中必须有一个32位的DLL。 但是我仍然不知道如何获得一组有用的日志来以逻辑的方式追踪这类问题。
最后一部分可能是罪魁祸首。你是否在正确的“比特性”中运行NUnit进程?你的组件瞄准什么? x86或x64? – 2010-11-05 11:32:56
@Lasse我认为一切都以“AnyCPU”为目标 – 2010-11-05 12:18:26
您是否引用了任何您不构建的外部程序集? – 2010-11-05 12:46:45