Visual Studio 当项目的OutputPath更改时,MSTest不执行单元测试

mcvgt66p  于 2023-11-21  发布在  其他
关注(0)|答案(1)|浏览(187)

当我为我的单元测试项目更改OutputPath时,测试仍然可以在Test Explorer中运行,但是当我尝试运行它们(右键单击->运行)时,它们不运行,并且我在输出窗口中得到下面的错误。为什么它突然找不到那个dll?

  1. Building Test Projects
  2. Starting test discovery for requested test run
  3. ========== Starting test discovery ==========
  4. Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Testhost process exited with error: Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.TestPlatform.CoreUtilities, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  5. File name: 'Microsoft.TestPlatform.CoreUtilities, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
  6. at Microsoft.VisualStudio.TestPlatform.TestHost.Program.Main(String[] args)
  7. . Please check the diagnostic logs for more information.
  8. at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.ThrowOnTestHostExited(Boolean testHostExited)
  9. at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources, String runSettings)
  10. at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyDiscoveryManager.DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEventsHandler2 eventHandler)
  11. ========== Test discovery aborted: 0 Tests found in 859.1 ms ==========
  12. ========== Starting test run ==========
  13. ========== Test run finished: 0 Tests (0 Passed, 0 Failed, 0 Skipped) run in < 1 ms ==========

字符串
OutputPath位置中的bin文件夹似乎包含了项目文件夹中bin文件夹中的所有文件,如果我没有更改OutputPath的话。
我使用Visual Studio 2022中的MStest。
我错过了什么?
x1c 0d1x的数据

vq8itlhq

vq8itlhq1#

https://stackoverflow.com/a/76718122/3817408似乎表明UseCommonOutputDirectory标志可能导致了此问题。

相关问题