尝试使用 Azure DevOps 进行 SqlAzureDacpacDeployment 时,找不到要使用搜索模式部署的文件

No files were found to deploy with search pattern when trying to SqlAzureDacpacDeployment with Azure DevOps

我尝试将 Dacpac 文件发布到 Azure SQL。 我将 Dacpac 文件正确发布到 Azure DevOps。我在 Artifact 的“drop”下看到 AzureSQL.dacpac。 但是我收到错误消息,想知道为什么找不到文件。

错误:

No files were found to deploy with search pattern d:\a\drop\AzureSQL.dacpacCheck out how to 
troubleshoot failures at https://aka.ms/sqlazuredeployreadme#troubleshooting-

代码:

 - task: PublishBuildArtifacts@1
   inputs:
      PathtoPublish: '$(Build.Repository.LocalPath)/AzureSQL/bin/Release/'
      ArtifactName: 'drop'
      publishLocation: 'Container'

- task: SqlAzureDacpacDeployment@1
  inputs:
     azureSubscription: xxxxxx
     AuthenticationType: xxxxxx
     ServerName: xxxxxx
     DatabaseName: xxxxxx
     SqlUsername: xxxxxx
     SqlPassword: xxxxxx
     deployType: 'DacpacTask'
     DeploymentAction: 'Publish'
     DacpacFile: '$(Pipeline.Workspace)/drop/AzureSQL.dacpac'
     IpDetectionMethod: 'AutoDetect'

我会在这里查找 dacpac 文件:$(System.ArtifactsDirectory)/drop/

更新

参考this文章,我相信你可以用

下载神器
- task: DownloadBuildArtifacts@0
  inputs:
    buildType: 'current'
    downloadType: 'single'
    artifactName: 'drop'
    downloadPath: '$(System.ArtifactsDirectory)/drop/AzureSQL.dacpac'

然后从 SqlAzureDacpacDeployment@1 中的下载路径访问它。也许您需要将 PublishBuildArtifacts@1 中的 PathtoPublish 更新为

'$(Build.Repository.LocalPath)/AzureSQL/bin/Release/AzureSQL.dacpac'