我正在尝试让 SourceLink 与私有 NuGet 包一起使用。我正在运行一个 netcore2.1 Web 应用程序,它引用托管在我们的 Azure Devops NuGet 源上的 netstandard2.0 NuGet 包。
问题 1: Source Link 是否支持 .NET Standard 包?
我已按照此处指南中的说明进行操作https://docs.microsoft.com/en-us/azure/devops/artifacts/symbols/setting-up-github-sourcelinking?view=vsts,基本上是:
将索引源和发布符号包添加到我的 Azure Devops 构建。
在 Visual Studio 中,将我们的 VSTS 服务器添加为符号服务器
在 Visual Studio 中,启用源链接支持。我还尝试启用源服务器支持。
构建管道发布符号路径似乎正在工作 - 在我看到的日志中:
Succeeded processing D:\a\1\s\src\MyCompany.Core.Services.SnapshotClient\bin\release\netstandard2.0\MyCompany.Core.Services.SnapshotClient.pdb:
当我开始调试我的应用程序时,我在 VS 输出窗口中看到一堆输出:
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\2.1.4\Microsoft.AspNetCore.Hosting.dll'. Cannot find or open the PDB file.
对于我的 NuGet 包,我看到“已加载符号”,这似乎很有希望。
FWIW 我没有看到 Visual Studio 提示“源链接将从 Internet 下载”。
当我调试并尝试进入我的 NuGet 包时,它只是跳过它。
然后我尝试了:
前往https://github.com/dotnet/sourcelink并按照他们的指示安装 Microsoft.SourceLink.Vsts.Git 包(问题 2是否有必要?)
当这不起作用时,我升级了我的应用程序中的每个该死的包,这迫使我安装 .NET Core SDK 2.1.403
在搜索GitHub 问题之后,尝试在我的 NuGet 包的 .csproj 中添加一些东西,
<PublishRepositoryUrl>true</PublishRepositoryUrl> <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
现在<DebugType>portable</DebugType> <ci>true</ci>
我的 .nupkg 也包含 .pdb 文件,这些文件以前不存在。尽管如此,仍然不能帮助我进行调试。从https://www.nuget.org/packages/sourcelink/安装 sourcelink cli 工具并
sourcelink print-urls
从我的 .nupkg 在 .pdb 上运行。看起来正确,我想?存在 URL。在看到@mitchdenny的评论https://github.com/MicrosoftDocs/vsts-docs/issues/1336#issuecomment-414415049后禁用索引。还是不行。
现在我很困惑为什么它不起作用。