Bunnynut
Bunnynut

Reputation: 1328

Unittests not running because of missing assembly

I have created a unittest but when I try to run I receive the following error message in JetBrains Rider. I have already tried a clean solution and a rebuild but to no avail. The project in question does not reference the assembly mentioned.

Test not run

Last runner error: TestRunner: NUnitTestReporter Could not load file or assembly 'nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

--- EXCEPTION #1/1 [LoggerException]
Message = “TestRunner: NUnitTestReporter Could not load file or assembly 'nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)”
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
HResult = COR_E_APPLICATION=80131600
StackTraceString = “
  at JetBrains.Util.ILoggerEx.LogMessage(ILogger this, LoggingLevel level, String message)
     at JetBrains.ReSharper.UnitTestFramework.TestRunner.ServerEndpoint.<>c__DisplayClass9_2.<TryRegisterHandler>b__3()
     at System.Threading.Tasks.Task`1.InnerInvoke()
     at System.Threading.Tasks.Task.Execute()
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
     at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
     at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
     at System.Threading.ThreadPoolWorkQueue.Dispatch()
”

Upvotes: 1

Views: 1329

Answers (1)

Athanasios Kataras
Athanasios Kataras

Reputation: 26352

Steps to follow for this one:

  1. Add nunit by using the package manager.
  2. Verify that nunit is in the references of the unit testing project
  3. Add the relevant binding redirect

This is an example, you might need to change it a bit.

<dependentAssembly>
  <assemblyIdentity name="nunit.framework"
    publicKeyToken="2638cd05610744eb"
    culture="en-us" />
  <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="3.12.0.0" />
</dependentAssembly>

You can find some more help HRESULT: 0x80131040: The located assembly's manifest definition does not match the assembly reference

Upvotes: 2

Related Questions