Levidoom
Levidoom

Reputation: 84

Error: No package found with specified pattern: D:\a\1\s\**\*.zip

I'm having a problem deploying my Blazor app to Azure Web App service trough the pipeline. All steps are passing except the Azure web App service deploy.

enter image description here

It gives me the error:

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

This is the problematic YAML pipeline:

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'

I'd be grateful if anyone can help, I'm a one-man operation :)

Upvotes: 1

Views: 8742

Answers (1)

Krzysztof Madej
Krzysztof Madej

Reputation: 40653

What you missing here is actually publishing your project. So first please remove this:

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

you don't need to copy whole source code and then publish it as pipeline artifact.

Please make also sure you use correct version of dotnet core. You may check it in csproj <TargetFramework>netcoreapp3.0</TargetFramework> and then make sure with task below that correct version is installed:

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

Then please add step to publish your project similar to this one (before publishing pipeline/build artifact)

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

and at the end please make sure you have correctly pass package in this step

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

Please notice that in that way you don't need to copy step because you publish to $(Build.ArtifactStagingDirectory) and you look for package to publish in $(Build.ArtifactStagingDirectory) and not in $(System.DefaultWorkingDirectory)

Upvotes: 2

Related Questions