我目前正在尝试使用 Azure DevOps 上的管道创建 Coverlet 覆盖率报告。但是,由于我的项目是“.Net FrameWork 4.7”项目,因此我无法像“.Net Core”项目一样使用“DotNetCoreCLI@2”任务创建覆盖率报告。
这是我的管道代码:
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
buildPlatform: 'Any CPU'
buildConfiguration: 'release'
Tests.Filter: '**\UnitTestProject1.dll'
Tests.Filter.Criteria: 'TestCategory!=Medium&TestCategory!=Large'
Tests.Filter.SettingsFile:
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '**/*.sln'
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: 'test'
projects: |
$(Tests.Filter)
!**\obj\**
publishTestResults: true
arguments: -c $(BuildConfiguration) --collect:"XPlat Code Coverage"
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install --tool-path . dotnet-reportgenerator-globaltool
displayName: Install ReportGenerator tool
- script: reportgenerator -reports:$(Agent.TempDirectory)/**/*.coverage -targetdir:$(Build.SourcesDirectory)/coverlet/reports -reporttypes:"Cobertura" …
Run Code Online (Sandbox Code Playgroud) .net frameworks code-coverage cobertura azure-devops-pipelines