当我为我的单元测试项目更改OutputPath
时,测试仍然可以在Test Explorer
中运行,但是当我尝试运行它们(右键单击->运行)时,它们不运行,并且我在输出窗口中得到下面的错误。为什么它突然找不到那个dll?
Building Test Projects
Starting test discovery for requested test run
========== Starting test discovery ==========
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.
File name: 'Microsoft.TestPlatform.CoreUtilities, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at Microsoft.VisualStudio.TestPlatform.TestHost.Program.Main(String[] args)
. Please check the diagnostic logs for more information.
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.ThrowOnTestHostExited(Boolean testHostExited)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources, String runSettings)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyDiscoveryManager.DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEventsHandler2 eventHandler)
========== Test discovery aborted: 0 Tests found in 859.1 ms ==========
========== Starting test run ==========
========== 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的数据
1条答案
按热度按时间vq8itlhq1#
https://stackoverflow.com/a/76718122/3817408似乎表明UseCommonOutputDirectory标志可能导致了此问题。