visual-studio - 项目中的每个测试都说“从实时单元测试中排除”?
问题描述
我根据文档https://docs.microsoft.com/en-us/visualstudio/test/live-unit-testing-faq?view=vs-2017添加了测试适配器和框架包。
我在每个测试旁边看到“烧杯”符号\图标,但悬停表示它已从实时单元测试中排除。
测试都可以手动运行,我尝试右键单击并告诉它包含,但什么也没做。我这里没有代码手动排除任何东西......
.net 4.7.1 项目
编辑
有错误
[10:03:48.205 错误] [TestRunner 1] 调用执行程序“executor://mstestadapter/v2”时发生异常:无法加载文件或程序集“System.Xml.ReaderWriter,版本=4.1.1.0,文化=中性” , PublicKeyToken=b03f5f7f11d50a3a' 或其依赖项之一。该系统找不到指定的文件。无法加载文件或程序集 'System.Xml.ReaderWriter, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 或其依赖项之一。该系统找不到指定的文件。
这是一个 4.7.1 项目,测试另一个基于 EFCore 的 4.7.1 项目。
解决方案
我收到了类似的相同错误,在“Live Unit Testing”类别的输出窗口中,我发现了以下错误:
FatalError - System.AggregateException: One or more errors occurred. ---> System.Exception: Could not load file or assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
我下载了该 nuget 包的最新版本,但它没有帮助,我基本上不得不在配置文件中强制使用 4.0.0.0 版本,这没有多大意义,因为 dll 的实际版本是 4.1。 2.0。无论如何,在那之后我停止并开始了 Live Unit Testing,现在它可以正常工作了。希望这可以帮助。
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.0.0.0" />
推荐阅读
- javascript - 通过箭头函数方法参数传递组件的值
- python - 如何为 django 模型 BooleanField 添加布尔按钮,以便普通用户可以将值设置为 true 或 false?
- python - 使用 BeautifulSoup 查找所有具有微小偏差的“ul”和“li”元素
- vuejs2 - vue router.push 未捕获(承诺)未定义
- azure - OauthPrompt 未导航到 Teams 上的登录页面
- python - 目录在不应该被拒绝时被拒绝
- tensorflow - 在图形模式下运行`defun`
- nlp - 使用 qunateda 包 rpart 在 R 中进行文本挖掘
- python - python代码将终止用户输入的另一个进程(例如chrome.exe)?
- go - 在 main 中找不到包