7

I have the following Azure Pipelines job:

- stage: Production
  dependsOn: Test
  jobs:
  - job: Publish
    pool:
      vmImage: 'Ubuntu 16.04'
    steps:
    - task: UseDotNet@2
      displayName: Setup
      inputs:
        packageType: sdk
        version: 3.1.x
    - task: DotNetCoreCLI@2
      displayName: Publish
      inputs:
        command: publish
        publishWebProjects: false
        projects: 'src/**/*.csproj'
        arguments: '--configuration production --output $(Build.ArtifactStagingDirectory)'
        zipAfterPublish: true
    - task: PublishPipelineArtifact@0
      displayName: Export
      inputs:
        artifactName: Production
        targetPath: '$(Build.ArtifactStagingDirectory)'
  - deployment: Deploy
    dependsOn: Publish
    pool:
      vmImage: Ubuntu-16.04
    environment: Production
    strategy:
      runOnce:
        deploy:
          steps:
          - task: DownloadPipelineArtifact@1
            displayName: Import
            inputs:
              artifactName: Production
          - task: AzureRmWebAppDeployment@3
            displayName: Web
            inputs:
              package: '$(Build.ArtifactStagingDirectory)/MyApp.Web.zip'
              azureSubscription: '$(azure.subscription)'
              appType: 'Web App on Windows'
              webAppName: 'my app'   

But now I am getting the error:

PublishPipelineArtifact is deprecated - Publish a local directory or file as a named artifact for the current pipeline

I have been searching for a solution but can't find any.

How to fix this?

Miguel Moura
  • 36,732
  • 85
  • 259
  • 481

1 Answers1

11

Update the PublishPipelineArtifact task version from @0 to @1. I added all updated input parameters in the screenshot below.

Your task from the provided example should look like this:

  - task: PublishPipelineArtifact@1
    displayName: Export
    inputs:
      artifact: Production
      targetPath: '$(Build.ArtifactStagingDirectory)'

enter image description here

LJ.
  • 620
  • 6
  • 12