I've got a set of unit tests that used to work very nicely in NCrunch and the Resharper 7 (in VS2012) test runner. I added SignalR and SignalR.Ninject through NuGet, and now my unit tests work in NCrunch, but no longer run in Resharper.
The TestFixtureSetUp failed with the following error:
SetUp : System.IO.FileLoadException : Could not load file or assembly
'Ninject, Version=2.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7'
or one of its dependencies. The located assembly's manifest definition does
not match the assembly reference. (Exception from HRESULT: 0x80131040)
at ProjectName.Infrastructure.SiteResolver.BindSignalR(IKernel kernel)
at ProjectName.Infrastructure.SiteResolver.RegisterServices(IKernel kernel) in SiteResolver.cs: line 29
at ProjectName.Tests.Unit.DataTests.Init() in DataTests.cs: line 48
In App.Config, I have
<runtime>
<assemblyBinding>
<dependentAssembly>
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
The equivalent in Web.Config works in the actual MVC project.
Any ideas how to fix it?
Update
I've tried with shadow-copying on and off, with no difference in outcome.
Update
Output from log file generated from Jim Skim's answer:
*** Assembly Binder Log Entry (15/10/2012 @ 16:43:47) ***
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 C:\Program Files (x86)\JetBrains\ReSharper\v7.0\Bin\JetBrains.ReSharper.TaskRunner.CLR4.MSIL.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = ######\simon
LOG: DisplayName = Ninject, Version=2.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7
(Fully-specified)
LOG: Appbase = file:///Z:/ProjectName/ProjectName.Tests.Unit/bin/Debug
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = ProjectName.Tests.Unit
Calling assembly : ProjectName.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: Z:\ProjectName\ProjectName.Tests.Unit\bin\Debug\ProjectName.Tests.Unit.dll.config
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: Ninject, Version=2.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///Z:/ProjectName/ProjectName.Tests.Unit/bin/Debug/Ninject.DLL.
LOG: Assembly download was successful. Attempting setup of file: Z:\ProjectName\ProjectName.Tests.Unit\bin\Debug\Ninject.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: Ninject, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: The assembly reference did not match the assembly definition found.
ERR: Run-from-source setup phase failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
From this link (mentioned originally by @bryanbcook), although the Resharper 7.1 upgrade didn't work, one of the commenters posted some code to force the resolution. I've filled in the blanks in my unit test base class: