简体   繁体   English

无法从Visual Studio访问VSTS符号服务器中发布的符号

[英]Unable to access symbols published in VSTS Symbol server from visual studio

I'm able to successfully publish symbols to the VSTS symbol server as part of the build execution. 作为构建执行的一部分,我能够成功将符号发布到VSTS符号服务器。

符号发布日志

Followed this link to setup visual studio and everything good until this point. 单击此链接可以设置Visual Studio,直至目前为止一切正常。 My symbol settings shown below: 我的符号设置如下所示:

在此处输入图片说明

When trying to debug, visual studio hits VSTS symbol server but return error message “Cannot find or open PDB file” 尝试调试时,Visual Studio会打VSTS符号服务器,但返回错误消息“找不到或打开PDB文件”

在此处输入图片说明

Below is the symbol load information provided by visual studio after trying to fetch from VSTS symbol server 下面是Visual Studio在尝试从VSTS符号服务器获取后提供的符号加载信息 在此处输入图片说明

As of November 15 2017 Visual Studio Online (also now known as Azure DevOps) the Index Sources and Publish Symbols build step handles the new portable PDB's create by dotnet build 截至2017年11月15日,Visual Studio Online(现在也称为Azure DevOps)的`` Index Sources and Publish Symbols构建步骤可处理通过dotnet build创建的新便携式PDB

You should tick Publish symbols and select your Subscription. 您应该勾选Publish symbols并选择您的订阅。 The free tier has 5 users. 免费套餐有5个用户。 You need to assign each user access to symbol server. 您需要为每个用户分配对符号服务器的访问权限。

Ticking the Index Sources check box makes no sense though as the source files are on the build server, usually in an obscure location such as C:\\agent\\_work\\34\\s\\... which will not match your local (or network path) to the source files. 勾选“ Index Sources复选框虽然没有意义,但由于源文件位于构建服务器上,通常位于诸如C:\\agent\\_work\\34\\s\\...这样的晦涩位置,因此与您的本地(或网络)不匹配路径)到源文件。

To help Visual Studio find the source files you can do this... (you can avoid this by using SourceLink as described below) 为了帮助Visual Studio查找源文件,您可以执行此操作...(您可以通过使用SourceLink来避免此问题,如下所述)

  • Select the solution in Solution Explorer and then choose Properties from the shortcut menu. 在解决方案资源管理器中选择解决方案,然后从快捷菜单中选择“属性”。
  • Under the Common Properties node, choose Debug Source Files. 在“公共属性”节点下,选择“调试源文件”。
  • Click the folder Tools/ Options/ Debugging/Symbols folder icon icon. 单击文件夹工具/选项/调试/符号文件夹图标图标。 Editable text appears in the Directories containing source code list. 可编辑文本出现在包含源代码的目录列表中。
  • Add the path that you want to search. 添加您要搜索的路径。

When you start debugging all the symbols will download and you can step into the source code now. 当您开始调试时,所有符号都会下载,您现在就可以进入源代码。

This does NOT require disabling just my code and you do not need to enable source server either. 这不需要仅禁用我的代码,并且您也不需要启用源服务器。


Unless you are using, or would like to use source server. 除非您正在使用,或想使用源服务器。 It is pretty easy to do now by adding a few packages... 现在添加一些软件包非常容易...

With AzureDev ops you can modify your build pipeline to make use of soruce files stored in GIT byt following this guide. 使用AzureDev ops,您可以按照本指南修改构建管道,以利用存储在GIT中的soruce文件。

The prerequisite is .NET Core SDK 2.1.300 or desktop msbuild version 15.7. 前提条件是.NET Core SDK 2.1.300或桌面msbuild版本15.7。

On your package project project you need to add NuGet package "SourceLink.Create.CommandLine" which will enable your build server (and your local build machine) to rewrite parts of the Portable PDB's without changing anything in the build pipeline. 在您的软件包项目项目中,您需要添加NuGet软件包“ SourceLink.Create.CommandLine”,这将使您的构建服务器(和本地构建计算机)能够重写便携式PDB的某些部分,而无需更改构建管道中的任何内容。

You also need to add a package to the correct source control. 您还需要将包添加到正确的源控件。 As described in this article. 如本文所述。 - I am using VSTS so I just install "Microsoft.SourceLink.Vsts.Git" package (must enable Include Prelease as of writing now) -我使用的是VSTS,所以我只安装“ Microsoft.SourceLink.Vsts.Git”包(必须在撰写本文时启用Include Prelease)

To verify this works all you need to do is build the project and look inside \\obj\\{config}\\{tfm}\\ for a file called *.sourcelink.json and has the correct URL's inside it. 要验证此方法是否有效,您只需构建项目,然后在\\obj\\{config}\\{tfm}\\中查找名为*.sourcelink.json的文件,并在其中包含正确的URL。

Then the usual pack and publish you would do. 然后按常规打包并发布即可。

In Visual Studio you just need to enable 在Visual Studio中,您只需要启用

  • Enable Source server support 启用源服务器支持
  • Enable Source Link support 启用源链接支持

You need to run the application built in the same build as the build to publish symbols to VSTS Symbol server, the identity will be different in the different builds. 您需要运行与构建相同的构建中构建的应用程序,以将符号发布到VSTS Symbol服务器,身份在不同的构建中将有所不同。

You can find that there is the GUID ( 0CD368C47775439… ) in the Symbol load information, also you can check the Publish symbols task's build log, there is the GUID too. 您可以在Symbol加载信息中找到GUID( 0CD368C47775439… ),也可以查看Publish Symbol任务的构建日志,也有GUID。 Within a build the GUIDs will be the same and the symbols will be loaded correctly during debug. 在内部版本中,GUID将相同,并且在调试期间将正确加载符号。

Did you enable Source Server Support in the VS.NET debug options ? 您是否在VS.NET调试选项中启用了源服务器支持? You might also uncheck 'Enable Just My Code' in the VS.NET debug options. 您还可以在VS.NET调试选项中取消选中“仅启用我的代码”。

There's a blogpost that I've recently written where I explain setting up and using a symbol server; 我最近写了一个博客文章,解释了如何设置和使用符号服务器。 might find some tips that might help you with your problem. 可能会找到一些技巧来帮助您解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM