Search code examples
azureazure-devopsazure-web-app-serviceazure-pipelinesazure-pipelines-yaml

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


I'm following the instructions on MSDN to set a pipeline to do 2 things

  1. Build
  2. Deploy to Web App created under my subscription

The current error i am receiving is

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

but after some changes i receive a similar error about the location.

Here is my 2 YAML files

`trigger:
- master


pool:
  vmImage: 'windows-latest'


variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'


steps:
- task: NuGetToolInstaller@1


- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'


- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'


- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'


- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(System.DefaultWorkingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'`

Deploy YAML

`trigger:
- master


pool:
  vmImage: 'windows-latest'


variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'


steps:
- task: NuGetToolInstaller@1


- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'


- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'


- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'
- task: AzureWebApp@1
  inputs:
    azureSubscription: 'NEW_SUB'
    appType: 'webApp'
    appName: 'Testing'
    package: '$(System.DefaultWorkingDirectory)/**/*.zip'
    deploymentMethod: 'auto'`

Every thread i have read i have tried a different path but it doesnt seem to work and i get an error about the file not found. I have also used the default config provided when i create a pipeline so i thought that would have limited the error factor.

What am i missing?

Also would it be correct to remove some of duplicate code from each YAML i.e. Nuget packages?

I have seen these threads and have attempted majority of the fixes but im not sure if i missed a critical step somewhere?

Azure DevOps pipeline release Error: No package found with specified pattern: D:\a\r1\a\**\*.zip

No package found with specified pattern: D:\a\r1\a\**\*.zip

i do see a file under artifacts when i look at the logs (under drop)


Solution

  • You publish your build result here:

    /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip"
    

    By default, it is located here: c:\agent_work\1\a

    However, you are trying to deploy this package:

    package: '$(System.DefaultWorkingDirectory)/**/*.zip'
    

    In this case, the build agent tries to check this folder: c:\agent_work\1\s

    Here is the documentation: https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml

    Update your last step to:

    - task: AzureWebApp@1
      inputs:
        azureSubscription: 'NEW_SUB'
        appType: 'webApp'
        appName: 'Testing'
        package: '$(build.artifactStagingDirectory)/WebApp.zip'
        deploymentMethod: 'auto'`
    

    or

    - task: AzureWebApp@1
      inputs:
        azureSubscription: 'NEW_SUB'
        appType: 'webApp'
        appName: 'Testing'
        package: '$(build.artifactStagingDirectory)/**/*.zip'
        deploymentMethod: 'auto'`