【发布时间】:2021-12-13 10:09:13
【问题描述】:
有以下单元测试任务
pool:
name: Azure Pipelines
vmImage: 'windows-2022' # Needed for .NET6 'windows-latest' did not work 2021 Dec
(...)
- task: VSTest@2
displayName: "Run unit tests"
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
**\*test*.dll
!**\*TestAdapter.dll
!**\obj\**
searchFolder: '$(System.DefaultWorkingDirectory)'
此任务不运行任何测试,它报告Could not load file or assembly 'System.Runtime, Version=6.0.0.0:
[MSTest][Discovery][...] Failed to discover tests from assembly D:\a\1\s\aaa\bin\Release\net6.0\aaa.dll. Reason:Could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
我的设置是
Starting: Initialize job
Agent name: 'Azure Pipelines 6'
Agent machine name: 'aaa'
Current agent version: '2.195.2'
Operating System
Virtual Environment
Virtual Environment Provisioner
Current image version: '20211206.1'
Agent running as: 'VssAdministrator'
Prepare build directory.
Set build variables.
Download all required tasks.
Downloading task: DotNetCoreCLI (2.187.0)
Downloading task: VSTest (2.195.0)
Downloading task: PublishPipelineArtifact (1.2.3)
Checking job knob settings.
Knob: AgentToolsDirectory = C:\hostedtoolcache\windows Source: ${AGENT_TOOLSDIRECTORY}
Knob: AgentPerflog = C:\agents\perflog Source: ${VSTS_AGENT_PERFLOG}
Finished checking job knob settings.
Start tracking orphan processes.
Finishing: Initialize job
如何让它运行我漂亮的测试?
【问题讨论】:
-
你好 tymtam;在尝试对其进行单元测试之前,我可以仔细检查您的管道是否已经构建您的应用程序?
-
是的,应用构建并发布成功。文物就在那里。
-
另外,本地测试运行正常。
标签: .net azure-devops azure-pipelines .net-6.0