如何修复无法加载文件或程序集'nunit.engine,版本= 3.7.0.0 [英] How to fix Could not load file or assembly 'nunit.engine, Version=3.7.0.0

查看:355
本文介绍了如何修复无法加载文件或程序集'nunit.engine,版本= 3.7.0.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web应用程序,其中包含一个单独的测试项目,使用NUnit运行单元测试.当我的测试项目试图发现测试时,我遇到了以下异常:

I have a webappliction with a separate test-project using NUnit to run unittests. When my test-project is trying to discover tests I run into the following exception:

An exception occurred while test discoverer 'NUnit3TestDiscoverer' was loading tests. Exception: Could not load file or assembly 'nunit.engine, Version=3.7.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' or one of its dependencies. The system cannot find the file specified.

这当然是一个非常常见的错误,但是我在任何地方都找不到对该特定程序集的引用,或者实际上是什么其他依赖关系导致了此问题.另一件事是,我当前安装了NUnit的3.9.0而不是提到的3.7.0. 我已经尝试清洁和重建解决方案,并还原了所有Nuget软件包,并且清除obj目录也无济于事.

This is of course a very common error, but I can't find a reference to this particular assembly anywhere or what other dependency is actually causing the issue. Another thing is that I currently have 3.9.0 installed of NUnit instead of the mentioned 3.7.0. I have already tried cleaning and rebuilding the solution and restored all Nuget packages and clearing the obj directory didn't help either.

推荐答案

最新版本的Visual Studio经常发生这种情况.我们不确定为什么,但是原因是Visual Studio缓存中测试适配器的副本不完整.解决方法是删除缓存的副本并重新启动Visual Studio.

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.

要删除的文件夹为C:\Users\username\AppData\Local\Temp\VisualStudioTestExplorerExtensions\NUnit3TestAdapter.3.x.x,具体取决于您的用户名和版本.

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.

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

这篇关于如何修复无法加载文件或程序集'nunit.engine,版本= 3.7.0.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆