PublishPipelineArtifact 已弃用 - 将本地目录或文件发布为当前管道的命名工件

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

我有以下 Azure Pipelines 作业:

- 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'   

但现在我收到错误:

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

我一直在寻找解决方案,但找不到。

如何解决这个问题?

将 PublishPipelineArtifact 任务版本从 @0 更新到 @1。我在下面的屏幕截图中添加了所有更新的输入参数。

所提供示例中的任务应如下所示:

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