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

Azure devops Azure管道任务VSTest@2失败,出现错误-无法加载文件或程序集';Microsoft.VisualStudio.TestPlatform.Common.resources';,azure-devops,azure-pipelines,azure-pipelines-build-task,azure-deployment,azure-pipelines-yaml,Azure Devops,Azure Pipelines,Azure Pipelines Build Task,Azure Deployment,Azure Pipelines Yaml,我已经创建了.NETCore3.1API测试用例项目。我的项目有以下金块包 Microsoft.NET.Test.Sdk 15.3.0 最小起订量4.16.1 xunit-2.4.1 xunit.runner.visualstudio-2.4.3 单元测试项目在VS2019中正确执行,我的所有测试用例都通过了。在部署yaml文件中,我有以下代码 - task: VSTest@2 - inputs: platform: '$(buildPlatform)' configu

我已经创建了.NETCore3.1API测试用例项目。我的项目有以下金块包

  • Microsoft.NET.Test.Sdk 15.3.0
  • 最小起订量4.16.1
  • xunit-2.4.1
  • xunit.runner.visualstudio-2.4.3
单元测试项目在VS2019中正确执行,我的所有测试用例都通过了。在部署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版本,但没有成功。非常感谢任何帮助。

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

-任务:VisualStudioTestPlatformInstaller@1
displayName:“安装Visual Studio测试平台”
投入:
packageFeedSelector:“nugetOrg”
版本选择器:“最新稳定”
-任务:VSTest@2
displayName:“运行单元测试”
投入:
vsTestVersion:“toolsInstaller”
#我们的测试项目名称中都有“.Tests”
testAssemblyVer2:“**/bin/$(构建配置)/*.Tests.dll”
平台:“$(构建平台)”
配置:“$(构建配置)”
已禁用的代码集:true
runTestsInIsolation:true

上述WaitingForGuacamole的答案与Microsoft.NET.Test.Sdk升级到16.9.1的结果是一致的。谢谢