在Gallio / MbUnit中运行的测试失败;无法加载Castle DynamicProxy

时间:2010-05-06 22:18:02

标签: .net mbunit gallio castle-dynamicproxy icarus

我有一个.NET 3.5程序集,大约有4000个MbUnit测试。我一直在使用mbunit.cons.exe程序运行它们,没有任何问题。

现在我正在尝试切换到Gallio(mbunit.cons.exe在生成XML报告时开始爆炸'内存不足'异常。)

在Icarus中运行测试时,大多数测试失败时出现以下异常:

System.TypeInitializationException: The type initializer for 'Rhino.Mocks.MockRepository' threw an exception. --->
System.IO.FileLoadException: Could not load file or assembly 'Castle.DynamicProxy2, Version=2.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference.
(Exception from HRESULT: 0x80131040) at Rhino.Mocks.MockRepository..cctor()

测试中的程序集确实使用动态代理。动态代理程序集与被测试的程序集位于同一目录中。

我已经尝试将包含程序集的目录放在Icarus的“提示目录”,“应用程序基础目录”和“工作目录”字段中,但这不会改变结果。

是否有人成功使用过Gallio和动态代理,或者对问题有什么提示?

1 个答案:

答案 0 :(得分:0)

看起来Rhino.Mocks引用了不同版本的Castle.DynamicProxy2。它试图寻找'Castle.DynamicProxy2, Version=2.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc'。您是否可以查看bin文件夹中的Castle.DynamicProxy2程序集,看看它是否具有相同的版本和PubliKeyToken