2
votes

This is an ASP.NET Core 3.0 project that builds with no errors, but when it triggers the pipeline to release to Azure App Service, it fails with the following error:

2019-11-10T23:09:23.8008460Z ##[error]Error: No package found with specified pattern: D:\a\r1\a***.zip

What needs to be done to fix the release pipeline? The pipeline release is pulling the latest build as its artifact.

enter image description here

3
It's failing for exactly the reason the error message says: No package found with specified pattern: D:\a\r1\a***.zip. It can't find the file you're telling it to deploy. Validate that the file you're trying to push exists in your build artifacts and is downloaded to the location you're specifying.Daniel Mann
Where do I find the build artifacts?crayden
I strongly recommend starting by reading the documentation, which explains these concepts and guides you on how to navigate through the various sections to find things.Daniel Mann
I have gone through a substantial amount of documentation, which has led me to ask this question here.crayden
Did you add the Publish Build Artifacts task in your build pipeline? If yes, which parameter do you set in the Path to publish option? Which task do you use in your release pipeline? Could you please share a screenshot of the release pipeline task condition setting? If convenience, could you please share your release pipeline log here?Frank Wang-MSFT

3 Answers

2
votes

The pipeline YAML was missing the following tasks. Not sure why this isn't included in the ASP.NET Core template, very confusing for developers new to Azure DevOps.

- task: DotNetCoreCLI@2
  inputs:
    command: 'publish'
    publishWebProjects: true

- task: CopyFiles@2
  inputs:
    targetFolder: '$(Build.ArtifactStagingDirectory)'

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'
2
votes

Assumptions

The following info assumes that you are appropriately publishing your build artifact from your Build pipeline, and that you have added the correct build artifact into you release pipeline.


In your release pipeline you have specified a build artifact in the Artifacts area enter image description here

When adding your build artifact to your release pipeline, you chose to give it an alias of Build Artifact. This means that at the very lease (with default settings) your .zip file will be in some sub-directory of $(system.DefaultWorkingDirectory)/Build Artifact/

A new unique folder in the agent is created for every release pipeline when you initiate a release, and the artifacts are downloaded into that folder. The $(System.DefaultWorkingDirectory) variable maps to this folder.


To ensure the uniqueness of every artifact download, each artifact source linked to a release pipeline is automatically provided with a specific download location known as the source alias. This location can be accessed through the variable:

$(System.DefaultWorkingDirectory)\[source alias]

This uniqueness also ensures that, if you later rename a linked artifact source in its original location (for example, rename a build pipeline in Azure Pipelines or a project in Jenkins), you don't need to edit the task properties because the download location defined in the agent does not change.

The source alias is, by default, the name of the source selected when you linked the artifact source, prefixed with an underscore; depending on the type of the artifact source this will be the name of the build pipeline, job, project, or repository. You can edit the source alias from the artifacts tab of a release pipeline; for example, when you change the name of the build pipeline and you want to use a source alias that reflects the name of the build pipeline.

(from some of the abundant documentation

Instead of searching for your package using ***.zip (which isn't proper wildcard syntax) use Build Artifact/**/*.zip

  • ** is for recursively searching into directories
    • (I don't know what folder)
  • * is for searching a part of a given level of the path
    • any file/folder that
      • starts with (SomeFile.*)
      • ends with (*File.zip)
      • and i think contains (*meFi*)
0
votes

When adding an Artifact of Source type "Build", select "Default version" as "Latest from the build pipeline default branch with tags", as follows:

enter image description here