【问题标题】:Not Loading Indexed Sources for nuget packages from Azure Devpos during debugging调试期间未从 Azure Devpos 加载 nuget 包的索引源
【发布时间】:2019-09-09 02:05:55
【问题描述】:

尝试使用 azure yml 构建管道以发布符号以允许使用 azure devops 调试 nuget pkg。我看到 PDB 文件被下载到符号缓存文件夹,但单步执行要求 Visual Studio 中的源文件位置,即使我在发布符号期间索引了源代码。

我尝试在 Visual Studio 调试中启用不同的选项,但似乎没有任何帮助

这是我的 yml


# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core

name: $(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) # need this for byBuildNumber verisonScheme nuget pack
# the build will trigger on any changes to the master branch
trigger:
- master

# the build will run on a Microsoft hosted agent, using the lastest Windows VM Image
pool:
  vmImage: 'windows-latest'

# these variables are available throughout the build file
# just the build configuration is defined, in this case we are building Release packages
variables:
  buildConfiguration: 'Release'


#The build has 3 seperate tasks run under 1 step
steps:

# The first task is the dotnet command build, pointing to our csproj file
- task: DotNetCoreCLI@2
  displayName: 'dotnet build'
  inputs:
    command: 'build'
    arguments: '--configuration $(buildConfiguration)'
    projects: 'src/Common.Core/Common.Core.csproj'

- task: PublishSymbols@2
  inputs:
    symbolsFolder: '$(Build.SourcesDirectory)'
    searchPattern: '**/bin/**/*.pdb' 
    indexSources: true
    publishSymbols: true
    symbolServerType: 'teamServices'        
    treatNotIndexedAsWarning: true 
    symbolsProduct: '$(Build.DefinitionName)'
    symbolsVersion: '$(Build.BuildNumber)'
    symbolsArtifactName: '$(name).Symbols_$(BuildConfiguration)'

# The second task is dotnet pack command again pointing to the csproj file
# The nobuild means the project will not be compiled before running pack, because its already built in above step
- task: DotNetCoreCLI@2
  displayName: "dotnet pack"
  inputs:
    command: 'pack'
    arguments: '--configuration $(buildConfiguration)'
    packagesToPack: 'src/Common.Core/Common.Core.csproj'
    nobuild: true
    includeSymbols: true
    versioningScheme: 'byBuildNumber'

# The last task is a nuget command, nuget push
# This will push any .nupkg files to the 'Nuget' artifact feed
# allowPackageConflicts allows us to build the same version and not throw an error when trying to push
# instead it just ingores the latest package unless the version changes
- task: NuGetCommand@2
  displayName: 'nuget push'
  inputs:
    command: 'push'
    feedsToUse: 'select'
    packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
    nuGetFeedType: 'internal'
    publishVstsFeed: 'myNuget'
    allowPackageConflicts: true

我希望当我调试带有启用了 idnexed 源代码的符号的 nuget 包时,它会自动下载 pdf 文件和源代码。

Visual Studio Settings for debugger

【问题讨论】:

  • 嗨,这个问题有什么更新吗?

标签: azure-devops nuget azure-pipelines visual-studio-debugging debug-symbols


【解决方案1】:

我看到 PDB 文件已下载到符号缓存文件夹,但是 单步执行是在 Visual Studio 中询问源文件位置, 即使我在发布符号期间索引了源代码。

您应该让调试器知道在哪里可以找到您的源文件。首先,请将您的 xx.nupkg 重命名为 xx.zip 并检查它是否包含必要的源文件。

之后您可以right-click Solution in Solution Explorer=>Properties=>Debug Source Files,单击New Line 选项将您的nuget 源文件的路径添加到debug source files 设置。

我希望当我使用符号调试 nuget 包时 启用了 idnexed 源代码,它会自动下载 pdf 文件和源代码。

也许您可以从this issue 获得一些帮助。您可以在为.net core 创建nuget 包时尝试将源文件的构建操作设置为C# compiler

【讨论】:

    猜你喜欢
    • 2020-04-23
    • 1970-01-01
    • 2013-06-15
    • 2018-09-21
    • 2023-01-03
    • 2015-11-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多