Index Sources & Publish Symbols task
Azure Pipelines | Azure DevOps Server 2019 | TFS 2018 | TFS 2017 | TFS 2015
A symbol server is available with Package Management in Azure Artifacts and works best with Visual Studio 2017.4 and newer. Team Foundation Server users and users without the Package Management extension can publish symbols to a file share using this task.
Use this task in a build or release pipeline to index your source code and optionally publish symbols to the Package Management symbol server or a file share.
Indexing source code enables you to use your .pdb symbol files to debug an app on a machine other than the one you used to build the app. For example, you can debug an app built by a build agent from a dev machine that does not have the source code.
Symbol servers enables your debugger to automatically retrieve the correct symbol files without knowing product names, build numbers or package names. To learn more about symbols, read the concept page; to publish symbols, use this task and see the walkthrough.
This build task works only:
- For code in Git or TFVC stored in Team Foundation Server (TFS) or Azure Repos. It does not work for any other type of repository.
# Index Sources & Publish Symbols # Index your source code and publish symbols to a file share or Azure Artifacts symbol server. - task: PublishSymbols@2 inputs: #symbolsFolder: '$(Build.SourcesDirectory)' # Optional #searchPattern: '**/bin/**/*.pdb' #indexSources: true # Optional #publishSymbols: true # Optional #symbolServerType: ' ' # Required when publishSymbols == True# Options: , teamServices, fileShare #symbolsPath: # Optional #compressSymbols: false # Required when symbolServerType == FileShare #detailedLog: true # Optional #treatNotIndexedAsWarning: false # Optional #symbolsMaximumWaitTime: # Optional #symbolsProduct: # Optional #symbolsVersion: # Optional #symbolsArtifactName: 'Symbols_$(BuildConfiguration)' # Optional
|Path to symbols folder||
The root path that is searched for symbol files using the search patterns supplied in the next input.
File matching pattern(s) (rooted at the path supplied in the previous input) used to discover
Adds information about the location of the source repository to the symbols. This enables users using these symbols to navigate to the relevant source code.
Publishes symbols to the symbol server selected in the next inputs.
|Symbol server type||
Package Management in Azure Artifacts:
|Path to publish symbols||
The path to the SymStore file share.
To prepare your SymStore symbol store:
If you leave this argument blank, your symbols will be source indexed but not published. (You can also store your symbols with your drops. See Publish Build Artifacts).
Only available when File share is selected as the Symbol server type. Compresses your
|Verbose logging||Enables additional log details.||Warn if not indexed||
Enable this option if you want the build summary to show a warning when sources are not indexed for a PDB file. A common cause of sources to not be indexed are when your solution depends on binaries that it doesn't build.
Even if you don't select this option, the messages are written in log.
|Max wait time (min)||If you want to set a time limit for this task, specify the number of minutes here. The build fails when the limit is reached. If you leave it blank, limit is 2 hours.|
|Product||If you are publishing your symbols, you can specify the product parameter that is passed to symstore.exe. If blank, $(Build.DefinitionName) is passed.|
|Version||If you are publishing your symbols, you can specify the version parameter that is passed to symstore.exe. If blank, $(Build.BuildNumber) is passed.|
|Artifact name||Specify the pattern used for the name of the link from the artifact tab in the build summary to the file share where
you are publishing your symbols. For example, if you specify
This task is open source on GitHub. Feedback and contributions are welcome.
Q & A
How does indexing work?
By choosing to index the sources, an extra section will be injected into the PDB files. PDB files normally contain references to the local source file paths only. For example,
C:\BuildAgent\_work\1\src\MyApp\Program.cs. The extra section injected into the PDB file contains mapping instructions for debuggers. The mapping information indicates how to retrieve the server item corresponding to each local path.
The Visual Studio debugger will use the mapping information to retrieve the source file from the server. An actual command to retrieve the source file is included in the mapping information. You may be prompted by Visual Studio whether to run the command. For example
tf.exe git view /collection:http://SERVER:8080/tfs/DefaultCollection /teamproject:"93fc2e4d-0f0f-4e40-9825-01326191395d" /repository:"647ed0e6-43d2-4e3d-b8bf-2885476e9c44" /commitId:3a9910862e22f442cd56ff280b43dd544d1ee8c9 /path:"/MyApp/Program.cs" /output:"C:\Users\username\AppData\Local\SOURCE~1\TFS_COMMIT\3a991086\MyApp\Program.cs" /applyfilters
Can I use source indexing on a portable PDB created from a .NET Core assembly?
No, source indexing is currently not enabled for Portable PDBs as SourceLink doesn't support authenticated source repositories. The workaround at the moment is to configure the build to generate full PDBs. Note that if you are generating a .NET Standard 2.0 assembly and are generating full PDBs and consuming them in a .NET Framework (full CLR) application then you will be able to fetch sources from Azure Repos (provided you have embedded SourceLink information and enabled it in your IDE).
Where can I learn more about symbol stores and debugging?
Do I need an agent?
You need at least one agent to run your build or release. Get an agent for Linux, macOS, or Windows.
I can't select a default agent pool and I can't queue my build or release. How do I fix this?
See Agent pools.
How long are Symbols retained?
When symbols are published to Azure Pipelines they are associated with a build. When the build is deleted either manually or due to retention policy then the symbols are also deleted. If you want to retain the symbols indefinitely then you should mark the build as Retain Indefinitely.
Send feedback about: