20

I'm trying to implement continuous integration and continuous deployment to my DEV Azure App Service. I'm using the hosted agent on Visual Studio Team Services. The "Deploy Website to Azure" step on my Release definition keeps failing with the error "No package found with specified pattern". Any ideas?

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

drewob
  • 487
  • 1
  • 4
  • 15

5 Answers5

27

"More than one package matched with specified pattern. Please restrain the search patern [sic]." error usually occurs when 2 or more packages were found by the task since you entered "xxx\*.zip" in "Package or Folder" setting of the task. So you just need to update it to specify the detailed package name. Similar question here: Deploy azure website and webjobs in same sln using VSO - Error - There can be only one.

And for you original issue, you can also fix it by creating a new build definition with "Visual Studio" selected on "Build" tab and "Azure WebApp" selected on "Deployment" tab. This will create a build definition with required arugments added.

SimonGoldstone
  • 5,096
  • 3
  • 27
  • 38
Eddie Chen - MSFT
  • 29,708
  • 2
  • 46
  • 60
  • 2
    This resolved it. It was my webjob project which was causing it to find multiple packages. – drewob Oct 31 '16 at 14:48
  • see: http://stackoverflow.com/questions/35385492/deploy-azure-website-and-webjobs-in-same-sln-using-vso-error-there-can-be-on – Patrick Borkowicz Jan 05 '17 at 21:25
  • 2
    Could you please explain more how do you update it to specify the detailed package name and what are you looking for a zip file that is to be created or one that already is created? – Demodave Jul 21 '17 at 14:03
7

Had the same problem few hours ago. This how I was able to resolve the issue:

  1. Ensure MSBuild arguments in Build solution step are: /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\"

  2. Add step Azure App Service Deployment: ARM

  3. Configure subscription and App Service Name
  4. Package or Folder should be $(build.artifactstagingdirectory)\**\*.zip

Steps:

Step definitions

Azure App Service Deployment Configuration:

enter image description here

Alex C
  • 16,624
  • 18
  • 66
  • 98
liri2006
  • 591
  • 7
  • 18
  • 2
    I'm getting closer thanks to your suggestion. However, now I get a "More than one package matched with specified pattern. Please restrain the search patern." on the deploy step. Any suggestions? – drewob Oct 27 '16 at 17:21
  • 2
    Mb you can try to explicitly name the package (both in build and deploy steps) like @Eddie - MSFT suggested: $(build.artifactstagingdirectory)\MyAwesomeAppPackage.zip – liri2006 Oct 29 '16 at 13:44
  • 1
    Thanks for this! Turns out markdown was eliminating required slashes. Have cleaned that up. – Alex C Nov 24 '16 at 20:07
2

if you are using the default azure app service deployment task, add this to end of YAML file:

- task: DotNetCoreCLI@2
  displayName: 'dotnet publish $(buildConfiguration)'
  inputs:
    command: publish
    publishWebProjects: True
    arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
    zipAfterPublish: True

- task: PublishBuildArtifacts@1
  displayName: 'publish artifacts'

I had the same issue and this worked for me:

# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/dotnet-core

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

variables:
  buildConfiguration: 'Release'

steps:
- script: dotnet build --configuration $(buildConfiguration)
  displayName: 'dotnet build $(buildConfiguration)'

- task: DotNetCoreCLI@2
  displayName: 'dotnet publish $(buildConfiguration)'
  inputs:
    command: publish
    publishWebProjects: True
    arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
    zipAfterPublish: True

- task: PublishBuildArtifacts@1
  displayName: 'publish artifacts'
CageE
  • 419
  • 4
  • 13
  • I was able to add the missing task and fix things by adding a publish task before my deploy task in Azure DevOps, via tasks > .NET Core and choosing publish from the command drop down. – Richard Garside Jul 20 '19 at 09:06
0

use the visual designer while creating build pipeline in azure devops,though your code sits at azure repos and github,

then select source

finally pick respective templates to your application

Kanna Reddy
  • 309
  • 4
  • 5
0

Make sure you didn't tick "Skip artifacts download"

Kevin Dimey
  • 709
  • 6
  • 15