How to fix Could not load file or assembly 'nunit.engine, Version=3.7.0.0

匆匆过客 提交于 2019-12-02 23:18:06

This is happening quite frequently with the latest versions of Visual Studio. We are not sure why, but the cause is an incomplete copy of the test adapter in the Visual Studio cache. The fix is to delete the cached copy and restart Visual Studio.

The folder you want to delete is C:\Users\username\AppData\Local\Temp\VisualStudioTestExplorerExtensions\NUnit3TestAdapter.3.x.x depending on your username and the version.

See https://github.com/nunit/nunit3-vs-adapter/issues/261 and http://hermit.no/how-to-resolve-cases-of-visual-studio-no-tests-appearing/

Seems in project file you have mentioned reference of 3.7.0 as GAC, and that dll is not available in GAC which is hopefully causing the failure.

In my case it was

An exception occurred while invoking executor 'executor://nunit3testexecutor/': Could not load file or assembly 'nunit.engine, Version=3.9.0.0

And the problem is: in my test project I have an import of NUnit3TestAdapter.3.13.0

  <Import Project="..\..\..\packages\NUnit3TestAdapter.3.13.0\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\..\..\packages\NUnit3TestAdapter.3.13.0\build\net35\NUnit3TestAdapter.props')" />

And in another project I have NUnit.Engine.3.10.0 referenced. but NUnit3TestAdapter.3.13.0 has Nunit.Engine.3.9.0 in the package.

\packages\NUnit3TestAdapter.3.13.0\build\net35

So, the solution was to downgrade Nunit.Engine in another project to 3.9 version.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!