gpt4 book ai didi

azure-devops - Azure 管道任务 VSTest@2 因错误而失败 - 无法加载文件或程序集 'Microsoft.VisualStudio.TestPlatform.Common.resources'

转载 作者:行者123 更新时间:2023-12-04 08:01:07 24 4
gpt4 key购买 nike

我创建了 .Net Core 3.1 API 测试用例项目。我的项目有以下金 block 包。

  • Microsoft.NET.Test.Sdk 15.3.0
  • Moq 4.16.1
  • xunit - 2.4.1
  • xunit.runner.visualstudio - 2.4.3

单元测试项目在 VS 2019 中正常执行,我的所有测试用例都通过了。在部署 yaml 文件中,我有以下代码。

- task: VSTest@2
- inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'

此任务因大量错误而失败

2021-03-03T18:33:16.4990294Z [MSTest][Discovery][D:\a\1\s\API\MyProject.ApiTests\bin\Release\netcoreapp3.1\cs\Microsoft.VisualStudio.TestPlatform.Common.resources.dll] Failed to discover tests from assembly D:\a\1\s\API\MyProject.ApiTests\bin\Release\netcoreapp3.1\cs\Microsoft.VisualStudio.TestPlatform.Common.resources.dll. Reason:Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.Common.resources' or one of its dependencies. The system cannot find the file specified.
2021-03-03T18:33:16.5032225Z [MSTest][Discovery][D:\a\1\s\API\MyProject.ApiTests\bin\Release\netcoreapp3.1\cs\Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll] Failed to discover tests from assembly D:\a\1\s\API\MyProject.ApiTests\bin\Release\netcoreapp3.1\cs\Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll. Reason:Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel.resources' or one of its dependencies. The system cannot find the file specified.
2021-03-03T18:33:16.5033961Z [MSTest][Discovery][D:\a\1\s\API\MyProject.ApiTests\bin\Release\netcoreapp3.1\de\Microsoft.TestPlatform.CommunicationUtilities.resources.dll] Failed to discover tests from assembly D:\a\1\s\API\MyProject.ApiTests\bin\Release\netcoreapp3.1\de\Microsoft.TestPlatform.CommunicationUtilities.resources.dll. Reason:Could not load file or assembly 'Microsoft.TestPlatform.CommunicationUtilities.resources' or one of its dependencies. The system cannot find the file specified.

等等。

我尝试升级/降级 Microsoft.NET.Test.Sdk 版本,但没有成功。任何帮助将不胜感激。

最佳答案

在我们的项目中,我们做了几件事:确保安装了正确的工具集,并具体说明测试路径:

          - task: VisualStudioTestPlatformInstaller@1
displayName: 'Install Visual Studio Test Platform'
inputs:
packageFeedSelector: 'nugetOrg'
versionSelector: 'latestStable'
- task: VSTest@2
displayName: 'Run Unit Tests'
inputs:
vsTestVersion: 'toolsInstaller'
# our test projects all have ".Tests" in the name
testAssemblyVer2: '**/bin/$(buildConfiguration)/*.Tests.dll'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
codeCoverageEnabled: true
runTestsInIsolation: true

关于azure-devops - Azure 管道任务 VSTest@2 因错误而失败 - 无法加载文件或程序集 'Microsoft.VisualStudio.TestPlatform.Common.resources',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66464426/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com