Azure devops 如何将可视化设计器中的管道移植到YAML管道中?分析块映射时,未找到所需的键

Azure devops 如何将可视化设计器中的管道移植到YAML管道中?分析块映射时,未找到所需的键,azure-devops,yaml,azure-pipelines,Azure Devops,Yaml,Azure Pipelines,因为我需要切换到YAML管道。 因此,我启动了一个新管道,并从可视化设计器中一个任务一个任务地粘贴YAML 我猜我不需要重复这个词 steps: 因此,整个管道现在都处于关闭状态 pool: vmImage: 'VS2017-Win2016' variables: buildConfiguration: 'Debug' steps: - task: DotNetCoreInstaller@0 displayName: 'Use .NET Core sdk 2.1.5' in

因为我需要切换到YAML管道。 因此,我启动了一个新管道,并从可视化设计器中一个任务一个任务地粘贴YAML

我猜我不需要重复这个词

steps:
因此,整个管道现在都处于关闭状态

pool:
  vmImage: 'VS2017-Win2016'

variables:
  buildConfiguration: 'Debug'

steps:
- task: DotNetCoreInstaller@0
  displayName: 'Use .NET Core sdk 2.1.5'
  inputs:
    version: 2.1.403


- task: DotNetCoreCLI@2
  displayName: Restore
  inputs:
    command: restore

    projects: '**/Api*.csproj'

    #Your build pipeline references an undefined variable named ‘Parameters.projects’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references the ‘BuildConfiguration’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971

- task: DotNetCoreCLI@2
  displayName: Publish
  inputs:
    command: publish

    publishWebProjects: false

    projects: '$(Parameters.projects)'

    arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)'

    - task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact'
  inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'
但这是一个错误

azure-pipelines.yml (Line: 35, Col: 5, Idx: 1118) - (Line: 35, Col: 6, Idx: 1119): While parsing a block mapping, did not find expected key.

问题在这一行
-任务:PublishBuildArtifacts@1
,带空格的行。只需将文本粘贴到行首即可

pool:
  vmImage: 'VS2017-Win2016'

variables:
  buildConfiguration: 'Debug'

steps:
- task: DotNetCoreInstaller@0
  displayName: 'Use .NET Core sdk 2.1.5'
  inputs:
    version: 2.1.403


- task: DotNetCoreCLI@2
  displayName: Restore
  inputs:
    command: restore

    projects: '**/Api*.csproj'

    #Your build pipeline references an undefined variable named ‘Parameters.projects’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references the ‘BuildConfiguration’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971

- task: DotNetCoreCLI@2
  displayName: Publish
  inputs:
    command: publish

    publishWebProjects: false

    projects: '$(Parameters.projects)'

    arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)'

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact'
  inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'

问题在这一行
-任务:PublishBuildArtifacts@1
,带空格的行。只需将文本粘贴到行首即可

pool:
  vmImage: 'VS2017-Win2016'

variables:
  buildConfiguration: 'Debug'

steps:
- task: DotNetCoreInstaller@0
  displayName: 'Use .NET Core sdk 2.1.5'
  inputs:
    version: 2.1.403


- task: DotNetCoreCLI@2
  displayName: Restore
  inputs:
    command: restore

    projects: '**/Api*.csproj'

    #Your build pipeline references an undefined variable named ‘Parameters.projects’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references the ‘BuildConfiguration’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971

- task: DotNetCoreCLI@2
  displayName: Publish
  inputs:
    command: publish

    publishWebProjects: false

    projects: '$(Parameters.projects)'

    arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)'

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact'
  inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'

我注意到它试图使用版本2.141.0进行构建,正如我之前提到的2.1.403。我注意到它试图使用版本2.141.0进行构建,正如我之前提到的2.1.403。否则,在任务中逐个粘贴Yaml代码而不重复“步骤:”似乎可行。完整的YAM可以在管道任务中找到。否则,在不重复“步骤:”的情况下逐个任务粘贴Yaml代码似乎有效。可以在管道任务中找到完整的YAM。