Publish *.snupkg symbol package to private feed in VSTS

喜欢而已 提交于 2020-12-30 05:58:22

问题


I want to package and publish a .net standard based code as a nuget package using VSTS build. I have created a private nuget feed (in VSTS Artifacts) to which I would like to publish nuget package along with symbols package.

I tried using dotnet CLI tasks to build and publish but it only publish .nupkg and not *.snupkg to the nuget feed.

I googled alot but I only found articles related to publishing to nuget.org and not to a private feed.


回答1:


Publish *.snupkg symbol package to private feed in VSTS

You can publish the .snupkg symbol package to NuGet.org, or to any NuGet server that opts into this experience. But azure devops private feed does not have this experience.

You can get the detailed info from this wiki NuGet Package Debugging & Symbols Improvements:

  • When publishing packages, both the symbols package and the .nupkg will be easily published to NuGet.org, or to any NuGet server that opts into this experience.

Reason:

As we know, when we consume .snupkg in Visual Studio, we add a new symbol server location under Symbol file (.pdb) locations:

But Visual Studio can only parse the symbol file (.pdb) directly rather than the .snupkg package, so we need a NuGet server to help us read the .pdb file from the .snupkg package. Azure devops feed is more inclined to be a shared repository of packages.

So, we have to publish *.snupkg symbol package to NuGet.org, or to any NuGet server that opts into this experience.

If you do not want share your package on the nuget.org, You can host your own NuGet server or you can use a lightweight solution to resolve this issue (You can debug the nuget package with private feed).

Hope this helps.




回答2:


You can publish the snupkg files to Azure DevOps, but at this point, you cannot consume them from with VS to debug. Here is how I did it:

1) setup a "Use .Net Core" task to upgrade the .net sdk to the version that supports this (as below)

2) setup a custom dotnet pack command (as below)

3) push it to Azure using the dotnet push command (as below)

This results in the snupkg being pushed to Azure DevOps Artifacts, thus:




回答3:


Azure Artifacts does not currently support .snupkgs but it does have a symbol server to which you can publish if you're building using Azure Pipelines. This doc walks through setting up a pipeline that publishes symbols.




回答4:


You may well want to just embed the symbol PDB in the main NuGet package itself. IMO that's the best approach here today - it's much simpler, removing the need for the symbol server at all and works well with all repository types, private VSTS/Azure DevOps feeds public repos. The only downside is that clients have to download modestly bigger NuGet packages even if they don't use the debug info, but that seems minor.

Adding the PDB in the NuGet package is normally just a matter of adding this to your project file:

<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>

See NuGet #4142 and Include pdb files into my nuget (nupkg) files.



来源:https://stackoverflow.com/questions/54211644/publish-snupkg-symbol-package-to-private-feed-in-vsts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!