Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publish *.snupkg symbol package to private feed in VSTS

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.

like image 562
Pradeep Avatar asked Jan 16 '19 06:01

Pradeep


People also ask

How do I push a package to feed my Azure DevOps?

Enter your Azure DevOps Services feed locator. Example: azure-feed://myOrg/myProject/myFeed@local. Select the Package type(s) you want to use and enter an Upstream source name. Select Save when you are done.


4 Answers

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:

enter image description here

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.

like image 98
Leo Liu-MSFT Avatar answered Oct 15 '22 07:10

Leo Liu-MSFT


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.

like image 34
Bret Johnson - MSFT Avatar answered Oct 15 '22 08:10

Bret Johnson - MSFT


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.

like image 21
Alex Mullans Avatar answered Oct 15 '22 08:10

Alex Mullans


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)

SDK install

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

pack command

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

dotnet push setup

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

result

like image 25
MercifulGiraffe Avatar answered Oct 15 '22 07:10

MercifulGiraffe