使用此任务为源代码编制索引,并将符号发布到文件共享或 Azure Artifacts 符号服务器。
通过对源代码编制索引,可以使用符号文件在用于生成应用程序的计算机上调试应用程序。 例如,可以从没有源代码的开发计算机调试生成代理生成的应用程序。
符号服务器使调试器能够自动检索正确的符号文件,而无需知道产品名称、内部版本号或包名称。
语法
# Index sources and publish symbols v2
# Index your source code and publish symbols to a file share or Azure Artifacts symbol server.
- task: PublishSymbols@2
inputs:
#SymbolsFolder: '$(Build.SourcesDirectory)' # string. Path to symbols folder. Default: $(Build.SourcesDirectory).
SearchPattern: '**/bin/**/*.pdb' # string. Required. Search pattern. Default: **/bin/**/*.pdb.
#Manifest: # string. Manifest.
#IndexSources: true # boolean. Index sources. Default: true.
#PublishSymbols: true # boolean. Publish symbols. Default: true.
SymbolServerType: # 'TeamServices' | 'FileShare'. Required when PublishSymbols = true. Symbol server type.
#SymbolsPath: # string. Optional. Use when PublishSymbols = true && SymbolServerType = FileShare. Path to publish symbols.
#CompressSymbols: false # boolean. Optional. Use when SymbolServerType = FileShare. Compress symbols. Default: false.
#SymbolExpirationInDays: '36530' # string. Optional. Use when PublishSymbols = true && SymbolServerType = TeamServices. Symbol Expiration (in days). Default: 36530.
# Advanced
#IndexableFileFormats: 'Default' # 'Default' | 'Pdb' | 'SourceMap' | 'All'. Optional. Use when PublishSymbols = true && SymbolServerType = TeamServices. Symbol file formats to publish. Default: Default.
#DetailedLog: true # boolean. Verbose logging. Default: true.
#TreatNotIndexedAsWarning: false # boolean. Warn if not indexed. Default: false.
#UseNetCoreClientTool: false # boolean. Use NetCore client tool. Default: false.
#SymbolsMaximumWaitTime: # string. Max wait time (min).
#SymbolsProduct: # string. Product.
#SymbolsVersion: # string. Version.
#SymbolsArtifactName: 'Symbols_$(BuildConfiguration)' # string. Artifact name. Default: Symbols_$(BuildConfiguration).
# Index sources and publish symbols v2
# Index your source code and publish symbols to a file share or Azure Artifacts symbol server.
- task: PublishSymbols@2
inputs:
#SymbolsFolder: '$(Build.SourcesDirectory)' # string. Path to symbols folder. Default: $(Build.SourcesDirectory).
SearchPattern: '**/bin/**/*.pdb' # string. Required. Search pattern. Default: **/bin/**/*.pdb.
#IndexSources: true # boolean. Index sources. Default: true.
#PublishSymbols: true # boolean. Publish symbols. Default: true.
SymbolServerType: # 'TeamServices' | 'FileShare'. Required when PublishSymbols = true. Symbol server type.
#SymbolsPath: # string. Optional. Use when PublishSymbols = true && SymbolServerType = FileShare. Path to publish symbols.
#CompressSymbols: false # boolean. Optional. Use when SymbolServerType = FileShare. Compress symbols. Default: false.
#SymbolExpirationInDays: '36530' # string. Optional. Use when PublishSymbols = true && SymbolServerType = TeamServices. Symbol Expiration (in days). Default: 36530.
# Advanced
#IndexableFileFormats: 'Default' # 'Default' | 'Pdb' | 'SourceMap' | 'All'. Optional. Use when PublishSymbols = true && SymbolServerType = TeamServices. Symbol file formats to publish. Default: Default.
#DetailedLog: true # boolean. Verbose logging. Default: true.
#TreatNotIndexedAsWarning: false # boolean. Warn if not indexed. Default: false.
#UseNetCoreClientTool: false # boolean. Use NetCore client tool. Default: false.
#SymbolsMaximumWaitTime: # string. Max wait time (min).
#SymbolsProduct: # string. Product.
#SymbolsVersion: # string. Version.
#SymbolsArtifactName: 'Symbols_$(BuildConfiguration)' # string. Artifact name. Default: Symbols_$(BuildConfiguration).
# Index sources and publish symbols v2
# Index your source code and publish symbols to a file share or Azure Artifacts symbol server.
- task: PublishSymbols@2
inputs:
#SymbolsFolder: '$(Build.SourcesDirectory)' # string. Path to symbols folder. Default: $(Build.SourcesDirectory).
SearchPattern: '**/bin/**/*.pdb' # string. Required. Search pattern. Default: **/bin/**/*.pdb.
#IndexSources: true # boolean. Index sources. Default: true.
#PublishSymbols: true # boolean. Publish symbols. Default: true.
SymbolServerType: # 'TeamServices' | 'FileShare'. Required when PublishSymbols = true. Symbol server type.
#SymbolsPath: # string. Optional. Use when PublishSymbols = true && SymbolServerType = FileShare. Path to publish symbols.
#CompressSymbols: false # boolean. Optional. Use when SymbolServerType = FileShare. Compress symbols. Default: false.
# Advanced
#DetailedLog: true # boolean. Verbose logging. Default: true.
#TreatNotIndexedAsWarning: false # boolean. Warn if not indexed. Default: false.
#SymbolsMaximumWaitTime: # string. Max wait time (min).
#SymbolsProduct: # string. Product.
#SymbolsVersion: # string. Version.
#SymbolsArtifactName: 'Symbols_$(BuildConfiguration)' # string. Artifact name. Default: Symbols_$(BuildConfiguration).
输入
SymbolsFolder
-
符号文件夹的路径
string
。 默认值:$(Build.SourcesDirectory)
。
指定使用符号文件搜索的文件夹的路径。 默认值为 $(Build.SourcesDirectory)
。 否则,请指定根路径,例如 $(Build.BinariesDirectory)/MyProject
。
注释
如果选择 Azure Artifacts 符号服务器作为服务器类型,则不支持 UNC 路径。
Manifest
-
清单
string
。
包含要发布的更多符号客户端密钥的文件的路径。
IndexSources
-
索引源
boolean
。 默认值:true
。
指定是否将源服务器信息注入 PDB 文件。 此选项仅在 Windows 代理上受支持。
PublishSymbols
-
发布符号
boolean
。 默认值:true
。
指定是否发布符号文件。
SymbolServerType
-
符号服务器类型
string
。
PublishSymbols = true
时是必需的。 允许的值:TeamServices
(此组织/集合中的符号服务器(需要 Azure Artifacts),FileShare
(文件共享)。
指定发布符号的位置。 任何有权访问组织/集合的用户都可以访问发布到 Azure Artifacts 符号服务器的符号。 Azure DevOps Server 仅支持 File share
选项。 请参阅 发布符号以调试 以在 Azure Artifacts 中使用符号服务器的说明。
SymbolsPath
-
发布符号的路径
string
。 可选。 当 PublishSymbols = true && SymbolServerType = FileShare
时使用。
指定托管符号的文件共享。 此值将在调用 symstore.exe add
中用作 /s
参数。
准备 SymStore 符号存储:
- 在文件共享服务器上设置文件夹以存储符号。 例如,设置
\fabrikam-share\symbols
。 - 向 生成代理服务帐户授予的完全控制权限。
如果将此参数留空,则符号将编制源索引,但不会发布。 还可以将符号与拖放一起存储。 请参阅发布生成项目。
CompressSymbols
-
压缩符号
boolean
。 可选。 当 SymbolServerType = FileShare
时使用。 默认值:false
。
在发布到文件共享时压缩符号。
SymbolExpirationInDays
-
符号过期(以天为单位)
string
。 可选。 当 PublishSymbols = true && SymbolServerType = TeamServices
时使用。 默认值:36530
。
指定应保留符号的天数。
IndexableFileFormats
-
用于发布 的符号文件格式
string
。 可选。 当 PublishSymbols = true && SymbolServerType = TeamServices
时使用。 允许的值:Default
(要上传的默认符号集)、Pdb
(仅基于 Pdb 的符号和托管的可移植 pdb 的符号)、SourceMap
(仅基于 JavaScript 的 SourceMap 符号(*.js.map))、All
(所有受支持的符号格式)。 默认值:Default
。
指定要发布到符号服务器的调试格式。
DetailedLog
-
详细日志记录
boolean
。 默认值:true
。
指定详细日志记录。
如果未编制索引,TreatNotIndexedAsWarning
- 警告
boolean
。 默认值:false
。
指定是否警告是否未为 PDB 文件编制源索引。 否则,消息将记录为正常输出。
UseNetCoreClientTool
-
使用 NetCore 客户端工具
boolean
。 默认值:false
。
指定是否使用支持 DWARF 和 ELF 文件的符号上传工具的版本。 此选项仅适用于 Windows 代理。 在非 Windows 代理上,将始终使用支持 DWARF 和 ELF 文件的符号上传工具的版本。
SymbolsMaximumWaitTime
-
最大等待时间(分钟)
string
。
指定在失败此任务之前等待的分钟数。
SymbolsProduct
-
产品
string
。
指定要 symstore.exe
的产品参数。 默认值为 $(Build.DefinitionName)
。
SymbolsVersion
-
版本
string
。
指定要 symstore.exe
的版本参数。 默认值为 $(Build.BuildNumber)
。
SymbolsArtifactName
-
项目名称
string
。 默认值:Symbols_$(BuildConfiguration)
。
指定要用于符号项目的项目名称。 这只能与 FileShare 符号服务器类型一起使用。 默认值为 Symbols_$(BuildConfiguration)
。
任务控制选项
除任务输入之外,所有任务都具有控制选项。 有关详细信息,请参阅 控件选项和常见任务属性。
输出变量
没有。
注解
使用此任务为源代码编制索引,并将符号发布到文件共享或 Azure Artifacts 符号服务器。
通过对源代码编制索引,可以使用符号文件在用于生成应用程序的计算机上调试应用程序。 例如,可以从没有源代码的开发计算机调试生成代理生成的应用程序。
符号服务器使调试器能够自动检索正确的符号文件,而无需知道产品名称、内部版本号或包名称。
索引的工作原理是什么?
通过选择为源编制索引,将向 PDB 文件注入额外的部分。 PDB 文件通常仅包含对本地源文件路径的引用,例如:C:\BuildAgent_work\1\src\MyApp\Program.cs。 注入到 PDB 文件中的额外部分包含调试器的映射说明。 映射信息指示如何检索对应于每个本地路径的服务器项。
Visual Studio 调试器将使用映射信息从服务器检索源文件。 用于检索源文件的实际命令包含在映射信息中。 示例:
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
是否可以对从 .NET Core 程序集创建的可移植 PDB 使用源索引?
否,但你可以改用 源链接。
符号保留多长时间?
符号与发布到 Azure Pipelines 的生成相关联,这些生成与生成相关联。 手动或使用保留策略删除生成时,也会删除这些符号。 如果要无限期保留符号,请将生成标记为 无限期保留。
要求
要求 | 说明 |
---|---|
管道类型 | YAML,经典生成 |
运行时间 | 代理,DeploymentGroup |
需求 | 没有 |
功能 | 此任务不满足作业中后续任务的任何要求。 |
命令限制 | 任何 |
|
任何 |
代理版本 | 2.144.0 或更高版本 |
任务类别 | 建造 |
要求 | 说明 |
---|---|
管道类型 | YAML,经典生成 |
运行时间 | 代理,DeploymentGroup |
需求 | 没有 |
功能 | 此任务不满足作业中后续任务的任何要求。 |
命令限制 | 任何 |
|
任何 |
代理版本 | 1.95.0 或更高版本 |
任务类别 | 建造 |