Search code examples
visual-studio-2015resharperresharper-2016

Resharper error running nunit tests for solution in Any CPU mode


I'm having trouble running resharper tests for my solution when targeting Any CPU. The error I'm getting is

ERROR System.IO.FileNotFoundException: Could not load file or assembly 'file:///D:_dist\path\to\my\bin\folder\JetBrains.ReSharper.UnitTestRunner.nUnit30.dll' or one of its dependencies. The system cannot find the file specified. at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) at System.Reflection.Assembly.LoadFrom(String assemblyFile) at JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTaskRunner.SetupRunnerAssembly(NUnitVersion nUnitVersion) at JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTaskRunner.SetUpNUnitRunner(NUnitVersion version, String nUnitInstallDir) at JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTaskRunner.RunTestsInAssemblies(List1 assemblies, NUnitTestAssemblySetTask assemblySetTask, Boolean useAddins, NUnitVersion nUnitVersion) at JetBrains.ReSharper.UnitTestRunner.nUnit.NUnitTaskRunner.ExecuteRecursive(TaskExecutionNode node) at JetBrains.ReSharper.TaskRunnerFramework.StartupTaskRunnerHost.Execute(TaskExecutionNode node) at JetBrains.ReSharper.TaskRunnerFramework.StartupTaskRunnerHost.ExecuteNodes(IEnumerable1 nodes) at JetBrains.ReSharper.TaskRunnerFramework.TasksPacketHandler.ThreadProc(TaskRunnerProxy proxy, IEnumerable`1 packets, AssemblyLoader loader)

When I turn the solution into x86, the tests run (but because these tests run fine for others with Resharper, I can't just go and create an x86 configuration in the solution).

Does anyone know what the issue is? I'm running VS2015, Resharper 2016.3.2, and the solution is a c#/asp.net mvc solution, with a Service Fabric microservice (the other reason I'd rather not resort to having to switch to x86 to run tests).

Any help is greatly appreciated.


Solution

  • If anyone runs into this, the error should push you to the thought of trying to figure out why it's trying to load ReSharper dlls from your projects bin folder.

    It looks like ReSharper uses System.Environment.CurrentDirectory to get its dlls, so when someone changed the value during one of the tests, it broke subsequent ones when ReSharper needed to access the nunit runner.