3
votes

I'm having this weird revision mismatch error. All my NUnit test projects used to work with NUnit 2.5.7, but now that I switched them to using NUnit v2.5.10, I keep on getting the following error:

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

Note: I cleaned up, rebuilt, double checked the references, no problem there.

Using the Assembly Binder Log Viewer (see below), it seems to me that the trigger of this error is the Spring.Testing.NUnit.dll... which seems weird given that the Spring.Testing.Nunit 1.3.2 Nuget page says in its Dependency List: NUnit (≥ 2.5.7)

Any idea what I'm missing here? Thanks in advance,

TB.

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 under executable F:\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/Application LOG: 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\Debug LOG: Dynamic Base = NULL LOG: Cache Base = C:\Users\tbourguignon.Mth\AppData\Local\Temp\nunit20\ShadowCopyCache\4980_634768419945070499 LOG: 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 from C:\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 was unsuccessful. LOG: Attempting download of new URL file:///F:/robin/4-Development/Workspace/Application/nunit.framework.DLL. LOG: Attempting download of new URL file:///F:/robin/4-Development/Workspace/Application/nunit.framework/nunit.framework.DLL. LOG: Attempting download of new URL file:///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.dll LOG: Entering download cache setup phase. LOG: Assembly Name is: nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77 WRN: Comparing the assembly name resulted in the mismatch: Revision Number ERR: The assembly reference did not match the assembly definition found. ERR: Setup failed with hr = 0x80131040. ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

2

2 Answers

2
votes

Did you gain anything from referencing a newer dot-version of NUnit? If not, the easiest thing you could do is go back and reference the older version of NUnit assemblies matching the version Spring is referencing in your code.

The other option is to modify your (Spring) application's configuration to use binding redirects to pick up the newer version of NUnit assemblies.

It makes me wonder if Spring's reference to NUnit's assembly had Specific Version set to true. Seems unlikely, though. Here's a reference on how .NET locates and binds assemblies at runtime.

0
votes

Somehow I managed to solve this issue... but I still don't know what caused it. I did a major cleanup of the references, excluding all the NUnit references from my project, removing all the DLLs and reintroducing the new DLL only. I can only guess that a DLL was stuck somewhere and Spring was picking it up instead of the new one... wild guess though :(