【问题标题】:Error: No package found with specified pattern: D:\a\1\s\**\*.zip错误:找不到具有指定模式的包:D:\a\1\s\**\*.zip
【发布时间】:2021-02-10 15:06:42
【问题描述】:

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

它给了我错误:

**##[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.**

这是有问题的 YAML 管道:

trigger:
 - master

pool:
  vmImage: 'windows-latest'

steps:
- task: DotNetCoreCLI@2
  inputs:
    command: 'build'
    projects: '**/*.csproj'
- task: CopyFiles@2
  inputs:
    sourceFolder: $(Build.SourcesDirectory)
    targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
- task: AzureWebApp@1
  inputs:
   azureSubscription: 'Pay-As-You-Go (********-****-****-****-************)'
   appType: 'webApp'
   appName: 'Xenoprovider'
   package: '$(System.DefaultWorkingDirectory)/**/*.zip'
   deploymentMethod: 'auto'

如果有人能提供帮助,我将不胜感激,我是单人操作:)

【问题讨论】:

  • zip 文件在哪里创建?在哪个位置?
  • 您需要将哪个文件上传到 azure Web 应用? zip 文件还是 razor 文件?
  • 事情是我不完全确定。我想我需要 zip 文件。我的最终目标是将应用程序作为产品发布(对 repo 进行更改,然后构建和部署)。事情是我通过 Visual Studio -> 发布操作手动执行此操作。但现在我想使用 Azure DevOps 来自动化该过程。

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


【解决方案1】:

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

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

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

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

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)中寻找要发布的包

【讨论】:

  • 谢谢。发布任务有一个问题:Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1 然后是[warning]Info: Azure Pipelines hosted agents have been updated to contain .Net Core 3.x (3.1) SDK/Runtime along with 2.1. Unless you have locked down a SDK version for your project(s), 3.x SDK might be picked up which might have breaking behavior as compared to previous versions. 最后是[error]Dotnet command failed with non-zero exit code on the following projects : D:\a\1\s\WEB\Xenoprovider\Xenoprovider.csproj
  • 我相信我已经接近解决方案了,所以非常感谢您提供的信息。
  • 你使用什么 dotnet core 版本?请检查这个文档站点docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/…你有定义dotnet核心版本的步骤。
  • 有没有办法检查 Azre DevOps 门户?但在我的 csproj 中,它被定义为:` "Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.1" "Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.1" Microsoft.AspNetCore.Components。 WebAssembly.DevServer" Version="3.2.1" Microsoft.AspNetCore.Http.Abstractions"`
  • 请在您的 csproj 中查看&lt;TargetFramework&gt;netcoreapp3.0&lt;/TargetFramework&gt;
猜你喜欢
  • 1970-01-01
  • 2019-01-18
  • 2021-09-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-08-25
相关资源
最近更新 更多