【发布时间】:2021-07-18 21:48:51
【问题描述】:
我有这个 Azure 构建管道,它启动一个 VSTest 任务。它应该测试所有以“Unittest.csproj”结尾的项目,但它应该排除以“Common.Unittest.csproj”结尾的测试项目:
# my-azure-pipeline.yaml:
...
steps:
- task: VSTest@2
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
**/*Unittest.csproj
! **/*Common.Unittest.csproj
...
这很好用。
由于我有几个类似的构建,我想提取一个构建模板 (myTemplate.yaml),它现在使用变量 $(testprojects) 来表示值“testAssemblyVer2”:
# myTemplate.yaml
...
steps:
- task: VSTest@2
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: $(testProjects)
...
现在我尝试像这样设置变量,但没有运气:
# my-azure-pipeline.yaml
...
variables:
- testProjects: |
**/FistUnittestProject.csproj
! **/SecondUnittestProject.csproj
extends:
template: myTemplate.yaml
...
我想知道通过变量定义“多行事物”的正确方法是什么?
任何帮助表示赞赏。
【问题讨论】:
标签: azure azure-devops azure-pipelines