gpt4 book ai didi

c# - NUnit DLL 版本不匹配

转载 作者:行者123 更新时间:2023-11-30 17:11:37 29 4
gpt4 key购买 nike

我遇到了这个奇怪的版本不匹配错误。我所有的 NUnit 测试项目过去都使用 NUnit 2.5.7,但现在我将它们切换为使用 NUnit v2.5.10,我不断收到以下错误:

FileLoadException: Could not load file or assembly 'nunit.framework, version 2.5.7...

注意:我清理、重建、仔细检查了引用,没有问题。

使用 Assembly Binder 日志查看器(见下文),在我看来,此错误的触发器是 Spring.Testing.NUnit.dll... 考虑到 Spring.Testing.Nunit 1.3.2 Nuget page,这似乎很奇怪在其依赖列表中说:NUnit (≥ 2.5.7)

知道我在这里缺少什么吗?提前致谢,

肺结核。

Assembly Binder Log Entry (02.07.2012 @ 16:06:35)

The operation failed.Bind result: hr = 0x80131040. No description available.

Assembly manager loaded from:C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll Running underexecutableF:\robin\4-Development\Workspace\3rdParty\NUnit\2.5.10\nunit-agent.exe--- A detailed error log follows.

=== Pre-bind state information === LOG: User = Mth\tbourguignon LOG: DisplayName = nunit.framework, Version=2.5.7.10213,Culture=neutral, PublicKeyToken=96d09a1eb7f44a77 (Fully-specified)LOG: Appbase = file:///F:/robin/4-Development/Workspace/ApplicationLOG: Initial PrivatePath =Rh.Robin.Common.Tests\bin\Debug;Rh.Robin.Service.Test\bin\Debug;Rh.Robin.Domain.Unit.Test\bin\Debug;Rh.Robin.Service.Unit.Test\bin\Debug;Rh.Robin.Web.UI.MVC.Unit.Test\bin\DebugLOG: Dynamic Base = NULL LOG: Cache Base =C:\Users\tbourguignon.Mth\AppData\Local\Temp\nunit20\ShadowCopyCache\4980_634768419945070499LOG: AppName = Tests_29030132 Calling assembly : Spring.Testing.NUnit,Version=1.3.2.40943, Culture=neutral, PublicKeyToken=65e474d141e25e07.=== LOG: This bind starts in default load context. LOG: No application configuration file found. LOG: Using host configuration file: LOG:Using machine configuration file fromC:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.LOG: Post-policy reference: nunit.framework, Version=2.5.7.10213,Culture=neutral, PublicKeyToken=96d09a1eb7f44a77 LOG: GAC Lookup wasunsuccessful. LOG: Attempting download of new URLfile:///F:/robin/4-Development/Workspace/Application/nunit.framework.DLL.LOG: Attempting download of new URLfile:///F:/robin/4-Development/Workspace/Application/nunit.framework/nunit.framework.DLL.LOG: Attempting download of new URLfile:///F:/robin/4-Development/Workspace/Application/Rh.Robin.Common.Tests/bin/Debug/nunit.framework.DLL.LOG: Assembly download was successful. Attempting setup of file:F:\robin\4-Development\Workspace\Application\Rh.Robin.Common.Tests\bin\Debug\nunit.framework.dllLOG: Entering download cache setup phase. LOG: Assembly Name is:nunit.framework, Version=2.5.10.11092, Culture=neutral,PublicKeyToken=96d09a1eb7f44a77 WRN: Comparing the assembly nameresulted in the mismatch: Revision Number ERR: The assembly referencedid not match the assembly definition found. ERR: Setup failed with hr= 0x80131040. ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

最佳答案

您是否从引用更新的 NUnit 点版本中获得了什么?如果没有,您可以做的最简单的事情就是返回并引用与 Spring 在您的代码中引用的版本匹配的旧版本的 NUnit 程序集。

另一种选择是修改您的(Spring)应用程序的配置以使用binding redirects。选择较新版本的 NUnit 程序集。

这让我想知道 Spring 对 NUnit 程序集的引用是否将 Specific Version 设置为 true。不过似乎不太可能。这是有关 .NET 如何使用的引用 locates and binds assemblies at runtime .

关于c# - NUnit DLL 版本不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11295967/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com