我正在从 VS2019 升级到 VS2022。我们已经编写了大约 1000 多个测试用例,我们可以在 VS2017 和 VS2019 上执行这些测试用例,但是当我在 VS2022 中打开项目时,测试用例不会运行。花费时间不到一毫秒,状态栏显示“测试运行已完成 0 次测试,(0 次通过,0 次失败,0 次在 <1 毫秒内跳过运行”
单击该图标后,文本资源管理器广告上报告了 1 个错误图标,或者当我尝试“调试”单个测试时,我在输出窗口中收到以下错误
Building Test Projects
Starting test discovery for requested test run
========== Starting test discovery ==========
System.IO.FileNotFoundException: Could not load file or assembly 'System.Text.Json, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Text.Json, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
at Microsoft.Extensions.DependencyModel.DependencyContextJsonReader.Read(Stream stream)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.GetTestHostPath(String runtimeConfigDevPath, String depsFilePath, String sourceDirectory) in /_/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DotnetTestHostManager.cs:line 763
at …Run Code Online (Sandbox Code Playgroud)