Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure devops 为什么这些Azure DevOps预定义变量不能在管道构建中工作?_Azure Devops - Fatal编程技术网

Azure devops 为什么这些Azure DevOps预定义变量不能在管道构建中工作?

Azure devops 为什么这些Azure DevOps预定义变量不能在管道构建中工作?,azure-devops,Azure Devops,给定以下yml代码片段,此脚本中使用的Azure DevOps管道不会被“拾取” pool: vmImage: 'Ubuntu 16.04' variables: buildConfiguration: 'Release' trigger: branches: include: - master paths: include: <snipped> pr: autoCancel: false paths: include:

给定以下yml代码片段,此脚本中使用的Azure DevOps管道不会被“拾取”

pool:
  vmImage: 'Ubuntu 16.04'

variables:
  buildConfiguration: 'Release'

trigger:
  branches:
    include:
    - master
  paths:
    include:
  <snipped>
pr:
  autoCancel: false
  paths:
    include:
  <snipped>

steps:
# Remove this task once .NET Core 2.2 is added to hosted agent.
- task: DotNetCoreInstaller@0
  inputs:
    packageType: 'sdk'
    version: '2.2.100'

- script: dotnet build --configuration $(buildConfiguration) -p:Version=$(Year:yyyy).$(Month).$(DayOfMonth).$(Rev:r)
  displayName: 'dotnet build'
  workingDirectory: 'src/<snipped>'
但是!当我手动定义生成名称时。。然后引用该变量。。它起作用了

name: $(Year:yyyy).$(Month).$(DayOfMonth).$(Rev:r)

  <snipped>

- script: dotnet build --configuration $(buildConfiguration) -p:Version=$(Build.BuildNumber)
  displayName: 'dotnet build'
  workingDirectory: 'src/<snipped>'
这是Azure DevOps的错误吗?

变量$Year:yyyy$Month$DayOfMonth$Rev:r不是常规预定义构建变量的一部分,如您所见,它们不在列表中

您只能在YAML中的内部版本号格式名称中使用这些变量

正如您所做的,您可以在那里使用它们,并且在构建过程中使用变量build.BuildNumber来获取值。

变量$Year:yyyy$Month$DayOfMonth$Rev:r不是常规预定义构建变量的一部分,正如您所看到的,它们不在列表中

您只能在YAML中的内部版本号格式名称中使用这些变量


就这样,您可以在那里使用它们,并在构建过程中使用变量build.BuildNumber来获取值。

AH!它们仅在生成生成名称时对可用。啊!!明白了!啊!它们仅在生成生成名称时对可用。啊!!明白了!助教。
name: $(Year:yyyy).$(Month).$(DayOfMonth).$(Rev:r)

  <snipped>

- script: dotnet build --configuration $(buildConfiguration) -p:Version=$(Build.BuildNumber)
  displayName: 'dotnet build'
  workingDirectory: 'src/<snipped>'