c# - NUnit 测试错误 'Could not load file or assembly..'

标签 c# nunit assemblies external

我一直在努力让 NUnit 测试类工作,我在 VS2012 下通过 Resharper 7.1.2 使用 NUnit 2.6.2。 我遇到的问题是,当我运行/调试测试用例时,NUinit 无法找到任何要测试的项目程序集。看起来所有的 dll 都在测试应用程序的调试文件夹中,但测试应用程序找不到它们。 使用 Fusion 日志我得到错误日志显示:-

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><!-- saved from url=(0015)assemblybinder: --></head><body><pre>*** Assembly Binder Log Entry  (21/06/2013 @ 08:46:43) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\Program Files (x86)\JetBrains\ReSharper\v7.1\Bin\JetBrains.ReSharper.TaskRunner.CLR4.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = PbakConnectAssy, Version=1.0.0.0, Culture=neutral, `enter code here`PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/JetBrains/ReSharper/v7.1/Bin/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = JetBrains.ReSharper.TaskRunner.CLR4.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\JetBrains\ReSharper\v7.1\Bin\JetBrains.ReSharper.TaskRunner.CLR4.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files (x86)/JetBrains/ReSharper/v7.1/Bin/PbakConnectAssy.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/JetBrains/ReSharper/v7.1/Bin/PbakConnectAssy/PbakConnectAssy.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/JetBrains/ReSharper/v7.1/Bin/PbakConnectAssy.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/JetBrains/ReSharper/v7.1/Bin/PbakConnectAssy/PbakConnectAssy.EXE.
LOG: All probing URLs attempted and failed.

</pre></body></html>

我完全被难住了,所以任何帮助将不胜感激。

最佳答案

将测试项目的目标平台更改为 x86。

更新:

ReSharper 7.1.2 在Visual Studio 2012 上运行时也存在错误。尝试将ReSharper 更新到7.1.3 版本。

这是一个相关问题:Resharper Test Runner: Could not load file or assembly 'System.Windows'

关于c# - NUnit 测试错误 'Could not load file or assembly..',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17230319/

相关文章:

c# - 使用绑定(bind)重定向降级(使用较低版本的库)

c# - Application.Designer.cs 错误 - 找不到程序集属性

c# - 下载数据时在 MonoTouch 中显示微调器

c# - 适用于 Windows 和 Linux 的同一台机器上的套接字

unit-testing - Nunit 并行运行测试不起作用

nunit - 带有 NCover 插件的 NCover Nunit CruiseControl.NET 任务

c# - 在 .NET Core App 1.0.0 项目中引用 Framework 4.6 库

c# - Moq - 是否可以在不使用 It.IsAny 的情况下设置模拟

ruby-on-rails - 将参数传递给 Rails 单元测试

在未引用的程序集中定义的 C# 类型