PublishSymbols@2 - 索引來源和發佈符號 v2 工作
使用此工作來編製原始程式碼的索引,並將符號發佈至檔案共用或 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 為基礎的符號 Windows pdb 和 Managed Portable pdb's),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 上使用來源索引嗎?
否,但您可以改用 Source Link。
符號會保留多久?
符號會與發佈至 Azure Pipelines 的組建相關聯,這些組建與組建相關聯。 手動或使用保留原則刪除組建時,也會刪除符號。 如果您要無限期保留符號,請將組建標示為 無限期保留。
需求
要求 | 說明 |
---|---|
管線類型 | YAML,傳統組建 |
執行於 | Agent、DeploymentGroup |
需求 | 沒有 |
功能 | 此工作不符合作業中後續工作的任何需求。 |
命令限制 | 任意 |
Settable 變數 | 任意 |
代理程式版本 | 2.144.0 或更新 |
工作類別 | 建造 |
要求 | 說明 |
---|---|
管線類型 | YAML,傳統組建 |
執行於 | Agent、DeploymentGroup |
需求 | 沒有 |
功能 | 此工作不符合作業中後續工作的任何需求。 |
命令限制 | 任意 |
Settable 變數 | 任意 |
代理程式版本 | 1.95.0 或更新 |
工作類別 | 建造 |