DevOp Pipeline: Error: More than one package matched with specified pattern: D:\a\r1\a\**\*.zip

##[error]Error: More than one package matched with specified pattern: D:\a\r1\a***.zip. Please restrain the search pattern.

I am new to DevOp. I am not quite know how to configure the yaml in the pipeline. By default, there was a template created and i added archives and publish task inside like this.

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: ArchiveFiles@2
  inputs:
    rootFolderOrFile: '$(Build.BinariesDirectory)'
    includeRootFolder: true
    archiveType: 'zip'
    archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
    replaceExistingArchive: true
    
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'

I guess there is something to do with

$(System.DefaultWorkingDirectory)/**/*.zip

Unsure what i need to configure.

1 answer

  • answered 2020-08-13 08:31 Jane Ma-MSFT

    ##[error]Error: More than one package matched with specified pattern: D:\a\r1\a***.zip. Please restrain the search pattern.

    This error message indicates that you have more than one .zip files in $(Build.ArtifactStagingDirectory).

    In your YAML file, both

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

    and

    archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
    

    generate .zip file in $(Build.ArtifactStagingDirectory).

    You need to specify which file you want to deploy, just like the following:

    $(System.DefaultWorkingDirectory)/**/WebApp.zip