[英]Binding redirect not working with multiple test projects in ReSharper's NUnit test runner
I use NSubstitute v1.7.1.0 and AutoFixture.AutoNSubstitute v3.16.5. 我使用NSubstitute v1.7.1.0和AutoFixture.AutoNSubstitute v3.16.5。 Obviously AutoFixture was compiled against an older version of NSubsitute.
显然,AutoFixture是针对较旧版本的NSubsitute进行编译的。
In a test I get the exception: 在测试中,我得到了例外:
System.IO.FileNotFoundException : Could not load file or assembly 'NSubstitute,
Version=1.4.3.0, Culture=neutral, PublicKeyToken=92dd2e9066daa5ca' or one of its
dependencies. The system cannot find the file specified.
So I added a binding redirect to my test project (as suggested here ): 所以我增加了一个绑定重定向到我的测试项目(如建议在这里 ):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NSubstitute" publicKeyToken="92dd2e9066daa5ca" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.7.1.0" newVersion="1.7.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Still getting the exception. 仍然有例外。 What am I doing wrong?
我究竟做错了什么?
EDIT : The problem disappears when I use AutoFixture for creating an instance of a class instead of an interface ( myFixture.Create<MyClass>()
instead of myFixture.Create<MyInterface>()
). 编辑:当我使用AutoFixture创建类而不是接口的实例(
myFixture.Create<MyClass>()
而不是myFixture.Create<MyInterface>()
)时,问题消失了。
The problem was caused by ReSharper's test runner. 该问题是由ReSharper的测试运行程序引起的。 It went away after increasing ReSharper's new "Run up to X assemblies in parallel" option as described in this answer .
如本答案所述,在增加了ReSharper的新的“并行运行X个程序集”选项后,它消失了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.