错误:找不到指定格式的软件包:D:\ a \ 1 \ s \ ** \ *。zip

时间:2020-10-28 09:10:18

标签: azure azure-devops yaml azure-web-app-service azure-pipelines

在通过管道将Blazor应用程序部署到Azure Web App服务时遇到问题。 除Azure Web App服务部署外,所有步骤都在通过。

enter image description here

它给了我错误:

USE DBName;
DBCC CHECKCONSTRAINTS(MainCheckTable) WITH ALL_CONSTRAINTS;

这是有问题的YAML管道:

**##[error]Error: No package found with specified pattern: D:\a\1\s\**\*.zip<br/>Check if the package mentioned in the task is published as an artifact in the build or a previous stage and downloaded in the current job.**

如果有人能帮助我,我将不胜感激,我是一个单人手术:)

1 个答案:

答案 0 :(得分:1)

您在这里缺少的实际上是在发布项目。所以首先请删除此内容:

task: CopyFiles@2
  inputs:
    sourceFolder: $(Build.SourcesDirectory)
    targetFolder: $(Build.ArtifactStagingDirectory)

您不需要复制整个源代码,然后将其发布为管道工件。

也请确保使用正确版本的dotnet core。您可以在csproj <TargetFramework>netcoreapp3.0</TargetFramework>中检查它,然后确保安装了正确版本的以下任务:

steps:
- task: UseDotNet@2
  inputs:
    version: '3.0.x'

然后(在发布管道/构建工件之前)添加类似于此步骤的步骤来发布您的项目

- task: DotNetCoreCLI@2
  displayName: Publish
  inputs:
    command: publish
    publishWebProjects: false
    projects: '$(projectDirectory)\hadar.csproj'
    arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
    zipAfterPublish: true

最后请确保您已正确通过此步骤中的包裹

- task: AzureWebApp@1
  displayName: Azure Web App Deploy
  inputs:
    azureSubscription: $(azureSubscription)
    appName: samplewebapp
    package: $(Build.ArtifactStagingDirectory)/**/*.zip

请注意,以这种方式,您无需复制步骤,因为您发布到$(Build.ArtifactStagingDirectory),并且您希望包发布在$(Build.ArtifactStagingDirectory)而不是$(System.DefaultWorkingDirectory)