1

I have nuget package with symbols - "Mypackage.symbols.nuget" and has dll and pdb files.

I created a local repository for testing and installed this "Mypackage.symbols.nuget" but after installing i see only dll file present in nuget folder under users directory and pdb is missing.

i tried a tweak by renaming the file manually to "Mypackage.nuget" from "Mypackage.symbols.nuget" and then i tried to install i see both dll and pdb is present after i installed.

Why does not pdb is getting downloaded when i have .symbols.nuget as i need to symbols package with dll and pdb for debugging purpose.

i created nuget package upon csproj property group.

Please suggest.

Arvind897
  • 101
  • 1
  • 8

1 Answers1

1

Mypackage.symbols.nuget is not a package in the form of being installed, and does not have the conditions for being installed. The purpose of this form of package is to publish to nuget.org together with nuget.nupkg. Usually, you should push the Mypackage.symbols.nupkg file into https://nuget.smbsrc.net/.

Before this, you should also push the Mypackage.nupkg into nuget.org(https://api.nuget.org/v3/index.json).

And then input the symbolsource.org(https://nuget.smbsrc.net/) into VS Symbol Server.

In this case, you could install the published Mypackage.nupkg package from the nuget.org and then it will match the related Mypackage.symbols.nupkg on the symbolsource.org so that you can debug the content of the nuget.

enter image description here

You can refer to this document about creating legacy symbol packages(.symbols.nupkg).

=============================================================

All of the above need to push these packages into nuget.org. And in the local, you should use that way. And Mypackage.symbols.nupkg is not an installed package for any projects.

To prove this, you can try these:

1) in my side, I add these node in csproj file to create the symbol package.

<PropertyGroup>
    <IncludeSymbols>true</IncludeSymbols>
</PropertyGroup>

enter image description here

Then, config the local path of it into nuget package source. After that, delete the xxx.nupkg directly,

enter image description here

I am sure that nuget package UI cannot find the package under the local path which proves the Mypackage.symbols.nupkg is not an installed nuget package and only be uploaded into the server.

Solution

1) just rename the Mypackage.symbols.nupkg as Mypackage.nupkg since it has the dll and pdb files.

2) use this csproj node to repack your project.

 <ItemGroup>
     <None Include="$(OutputPath)$(AssemblyName).pdb" Pack="true" PackagePath="lib\$(TargetFramework)"></None>
 </ItemGroup>

And the main xxx.nupkg will contain the pdb file.

3) also use this xml node in csproj file:

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

Note: if you want to debug the nuget package locally, you should also pack the resource files into the nupkg file.

See this thread answered by me.

In addition, using Debugging information: Embedded format might be much easier.

Mr Qian
  • 21,064
  • 1
  • 31
  • 41
  • Thanks for the help. Also i found one more way to have nuget package with pdb's and we need to add this node to propertygroup - $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb – Arvind897 Sep 23 '20 at 09:39