使用 Linux 生成代理的 Azure Devops 中的 Nuget 符号
Nuget symbols in Azure Devops with Linux build agent
我目前正在尝试启用 nuget 库以在 CI/CD 进程中进行本地调试。
现状
我在 Azure Devops 上有一个构建配置,它使用 Ubuntu 代理。构建发布工件和发布管道 packs/pushes nuget 包到 Azure Artifacts。
首先,我尝试使用 snupkg 格式发布 pdb 文件,但 Azure Artifacts 不支持这些文件。 https://developercommunity.visualstudio.com/t/add-snupkg-support-to-azure-devops-artifacts/657354
我尝试按照本教程进行操作。 https://docs.microsoft.com/en-us/azure/devops/artifacts/symbols/setting-up-github-sourcelinking?view=azure-devops
第一个障碍是发布符号 publish 的任务不适用于 Linux,而仅适用于 Windows。 https://github.com/microsoft/azure-pipelines-tasks/issues/5919
因此我在使用符号服务器时运气不佳。我通过在 .csproj
文件
中添加以下内容找到了解决方法
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
现在符号打包在 nuget 文件中,但当我使用 visual studio 中的包时仍然不会自动加载。 (我取消选中仅在 VS 中启用我的代码)
当我在 Visual Studio 的模块 windows 中手动添加它们时,它起作用了。
是否有任何方法可以在 Azure Devpos 中使用 Linux 代理构建 CI/CD 进程以使符号正常工作?或者 VS 可以在加载 nuget 包时自动加载符号吗?
我的项目是.net standard 2.1/.net framework 5。
构建:Azure Devops(Ubuntu 代理)
Nuget 存储库:Azure Artifacts
Visual studio: 对比 2019 16.8.4
非常感谢大家的帮助。
谢谢
Now the symbols are packed within the nuget file but still not loaded
automatically when I am using the package in visual studio. (I
unchecked Enable just my code in VS)
对于此问题,这是预期的行为。通常我们使用 Index Sources & Publish Symbols
任务将符号发布到 Azure Artifact 中的符号服务器(Azure Artifacts 提供了专用的符号服务器来发布您的符号)。然后在 Visual Studio 中,添加新的符号服务器(拥有管道并托管工件提要的组织)。配置后,Visual Studio 将与符号服务器建立连接并尝试定位符号。
因为你只打包了nuget文件中的symbols,并没有发布symbols到symbols server。所以VS中不会自动加载symbols
因此您需要手动将它们添加到 Visual Studio 的“模块”window 中才能使其正常工作。
如果想让VS自动加载symbols,在azure pipeline中,可以尝试使用两个agent job,在第二个agent job中使用windows agent到运行 Index Sources & Publish Symbols
将符号发布到 Azure Artifact 中的符号服务器的任务。
我目前正在尝试启用 nuget 库以在 CI/CD 进程中进行本地调试。
现状
我在 Azure Devops 上有一个构建配置,它使用 Ubuntu 代理。构建发布工件和发布管道 packs/pushes nuget 包到 Azure Artifacts。
首先,我尝试使用 snupkg 格式发布 pdb 文件,但 Azure Artifacts 不支持这些文件。 https://developercommunity.visualstudio.com/t/add-snupkg-support-to-azure-devops-artifacts/657354
我尝试按照本教程进行操作。 https://docs.microsoft.com/en-us/azure/devops/artifacts/symbols/setting-up-github-sourcelinking?view=azure-devops
第一个障碍是发布符号 publish 的任务不适用于 Linux,而仅适用于 Windows。 https://github.com/microsoft/azure-pipelines-tasks/issues/5919
因此我在使用符号服务器时运气不佳。我通过在 .csproj
文件
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
现在符号打包在 nuget 文件中,但当我使用 visual studio 中的包时仍然不会自动加载。 (我取消选中仅在 VS 中启用我的代码)
当我在 Visual Studio 的模块 windows 中手动添加它们时,它起作用了。
是否有任何方法可以在 Azure Devpos 中使用 Linux 代理构建 CI/CD 进程以使符号正常工作?或者 VS 可以在加载 nuget 包时自动加载符号吗?
我的项目是.net standard 2.1/.net framework 5。 构建:Azure Devops(Ubuntu 代理) Nuget 存储库:Azure Artifacts Visual studio: 对比 2019 16.8.4
非常感谢大家的帮助。
谢谢
Now the symbols are packed within the nuget file but still not loaded automatically when I am using the package in visual studio. (I unchecked Enable just my code in VS)
对于此问题,这是预期的行为。通常我们使用 Index Sources & Publish Symbols
任务将符号发布到 Azure Artifact 中的符号服务器(Azure Artifacts 提供了专用的符号服务器来发布您的符号)。然后在 Visual Studio 中,添加新的符号服务器(拥有管道并托管工件提要的组织)。配置后,Visual Studio 将与符号服务器建立连接并尝试定位符号。
因为你只打包了nuget文件中的symbols,并没有发布symbols到symbols server。所以VS中不会自动加载symbols
因此您需要手动将它们添加到 Visual Studio 的“模块”window 中才能使其正常工作。
如果想让VS自动加载symbols,在azure pipeline中,可以尝试使用两个agent job,在第二个agent job中使用windows agent到运行 Index Sources & Publish Symbols
将符号发布到 Azure Artifact 中的符号服务器的任务。