Reputation: 18160
Because of this question I needed to switch to a YAML pipeline. Thus I started a new pipeline and pasted in the YAML task by task from the visual designer.
I am guessing that I don't need to repeat the word
steps:
Thus the whole pipeline is now
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)'
But this gives an error
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.
Upvotes: 0
Views: 1392
Reputation: 41715
The issue is in this line - task: PublishBuildArtifacts@1
, the line with spaces. just stick the text to the beginning of the line.
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)'
Upvotes: 3