尝试执行引用nunit.framework的单元测试失败:
System.IO.FileNotFoundException: Could not load file or assembly
'nunit.framework, Version=2.5.10.11092, Culture=neutral,
PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The
system cannot find the file specified.我的场景如下:
Visual Studio 2010 TFS
C#和.NET FramewokV4.0
NUnit 2.6.0.12051
详细说明:
我有一个测试项目,它引用了一些dlls,其中一个是nunit.framework.dll。此dll (nunit.framework.dll)指向安装nunit 2.6.0.12051的文件夹。我通过nunit-x86.exe执行NUnit (不是从visual studio执行),一旦加载,我就加载测试项目(它是一个类库,dll)。N单元尝试加载,但上面解释的错误说明appears.Test项目编译正常,动态链接库生成正确。此外,测试项目的目标是.NET框架v4.0。
发布于 2014-11-15 03:24:25
请尝试在您的配置文件中重定向程序集绑定:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.6.0.12051" newVersion="2.6.0.12051"/>
</dependentAssembly>
</assemblyBinding>
</runtime>您可能已经有了类似上面的记录。在这种情况下,只需调整"newVersion“值即可。
https://stackoverflow.com/questions/14081646
复制相似问题