In the Azure Pipelines PublishSymbols task, how to specify multiple search patterns?

1.2k views Asked by At

We have the following PublishSymbols task in our pipeline, and it's working correctly.

  - task: PublishSymbols@2
inputs:
  symbolsFolder: $(Pipeline.Workspace)/s/Server
  searchPattern: "**/*.pdb"
  indexSources: true
  publishSymbols: true
  symbolServerType: TeamServices
  symbolsProduct: "ACM"
  symbolsVersion: $(major).$(minor).$(revision)
  symbolsArtifactName: "Symbols_ACM.$(major).$(minor).$(revision)_$(buildConfiguration)"
enabled: true
condition: eq(variables['doPublishSymbols'], 'true')
displayName: Create symbol table

However, we want to fine tune the searchPattern input, so that it only looks for PDB files that begin with abc or xyz. How can I do this?

  1. Comma-separated strings?

    searchPattern: "**/abc*pdb", "**/xyz*pdb"

  2. Array?

    searchPattern: @("**/abc*pdb", "**/xyz*pdb")

  3. Some kind of OR symbol?

    searchPattern: "**/abc*pdb" | "**/xyz*pdb"

  4. How about PowerShell newlines? From the source files on Github, I deduced that this might be the solution:

    searchPattern: "**/abc*pdb`n**/xyz*pdb"

but this was the result:

Found 0 files.

##[warning]No files selected for indexing.

A RELATED QUESTION, DEALING WITH OTHER FILE TYPES:

My colleagues are suggesting that I include the EXE or DLL files associated with the PDB files, so the searchPattern will also include "abc*exe", "abc*dll", and so on. Does PublishSymbols need these additional files? Or do the PDB files contain all of the information required by the task?

I've researched symbols, symstore.exe, and symbol.exe on the Web, and I haven't found a good answer to this question yet.

1

There are 1 answers

2
Leo Liu On BEST ANSWER

In the Azure Pipelines PublishSymbols task, how to specify multiple search patterns?

You could specify multiple search patterns directly with newlines:

- task: PublishSymbols@2
  displayName: 'Publish symbols path'
  inputs:
    SearchPattern: |
     **\bin\**\abc*.pdb
     **\bin\**\xyz*.pdb
    indexSources: true

so the searchPattern will also include "abcexe", "abcdll", and so on. Does PublishSymbols need these additional files? Or do the PDB files contain all of the information required by the task?

According to the document Publish symbols for debugging

With Azure Pipelines, you can publish your symbols to Azure Artifacts symbol server using the Index sources and publish symbols task.

So, PublishSymbols need these additional files, those files should be contained in the corresponding nuget package instead of in the Symbols package.