Is it possible to host both regular and symbols packages in a NuGet local feed on a network share?

How can I do this – using both regular packages and symbol packages – when using only a network share folder as a local feed?

I`m afraid the answer is no. When I host both regular and symbols packages in a NuGet local feed on a network share, then I installed that package to my test project, go to debug, Visual Studio could not load the .pdb file. Because the .pdb file is wrapped in the symbol package, Visual Studio could not access it directly. So the suggestion is that “using a separate symbols server.“.

Since you can’t publicly publish this code to symbolsource.org and can not currently able to get a server from your employer for hosting one, I would like provide you a lightweight solution here:

  1. Put the pdb and source code file in the NuGet package alongside the dll.
  2. Add the source code to the Debug Source Files for the solution that references the package.

This means you’ll be able to step through code and view exceptions, but you might have to find a file on disk and open it before you can set a break point. Obviously you need to be careful that the source is at the right revision.

More detail on step 1:

If you’re currently packaging without a Nuspec, you’ll need to create a Nuspec, then add the pdb to the list of files in the lib folder and source file in the src folder. “NuGet spec” may be a useful command for generating the initial spec as defined in NuGet docs. Below is my .nuspec file, you can check it:

<?xml version="1.0"?>
  <package >
    <metadata>
     <id>MyTestPackage</id>
     <version>1.0.3</version>
     <authors>Admin</authors>
     <owners>Admin</owners>
     <requireLicenseAcceptance>false</requireLicenseAcceptance>
     <description>Package description</description>
     <releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
     <copyright>Copyright 2017</copyright>
     <tags>Tag1 Tag2</tags>
   </metadata>

   <files>
     <file src="bin\Debug\MyTestPackage.dll" target="lib\Net46" />
     <file src="bin\Debug\MyTestPackage.pdb" target="lib\Net46" />
     <file src="Class1.cs" target="src" />
   </files>
</package>

More detail on step 2:

When you have a solution open, right click on Solution, select Properties…Common Properties…Debug Source Files, and add the root source directory for the relevant binary reference.

enter image description here

Or see MSDN. Note, you can’t open the solution properties while debugging.

With this settings in the .nuspec, you only need to set this regular package in a NuGet local feed on a network share. Install this package, then you can to debug within the package itself.

Besides, SymbolSource released a community edition called SymbolSource Server Basic now.

Leave a Comment