Skip to content

How to build and publish Nuget packages with source-symbols to VSTS

We read about that Visual Studio Team Services (VSTS) now not only support hosting your Nuget package feeds but also your source-symbols and source-symbol packages. This sounds very promissing in case you host your own Nuget’s und like to be able to debug them within your applications.

At my work we have an internal framework that is packaged in multiple Nuget packages. These packages are built by the VSTS Build-Job and get published to the VSTS hosted package feed in the Release-Job. It is consumed and used by our application using VSTS as a regular Nuget-Server.

As it was not trivial to get all running I do a quick summary here. Please also note, that a lot the Microsoft Docs are at least a little out of date. That seems to be the result of the new agile world we are living in.

Install package-management and enable source-symbol server

First of all you have to install the package-manager extension in VSTS. As source-symbol server feature currently is in preview you have to enable this feature-preview in the VSTS admin section. Read more about it here…

Index Sources & Publish Symbols

Then you compile your assembly’s by default you’ll get a .PDB file. This default is not only for debug- but also for release-builds. You can configure it the project settings of each assembly you have. Enable PDB generation. PDB’s are binary files containing debugging information.

To get enhanced mapping information pushed into the PDB’s you’ll need to add the build task “Index Source & Publish Symbols”.

As you can see in the above screen-shoots I inserted this build task after building the solution and running the unit-tests. I set it to publish to the same VSTS account as the build-job runs.

For packing Nuget packages one can also configure to pack symbol-packages too. That means that not one but two packages will be generated by the Nuget-Task: the regular Nuget and the .symbols-Nuget package. So’ll see the important peaces here:

That’s it for the build-job. Let’s go to deplyoment (aka Release-Job).

Deployment (aka Release-Job)

The good news here is that you don’t have to do anything to support source-symbol packages if you use the defaults of VSTS. The symbol-Packages get automatically picket up by the Nuget-Task if they exists in your build-artifacts.

Make sure you are using the newer Nuget-Task as the old one is deprecated anyway. Then make sure the .symbols.nupkg is in your path configuration. Again you can configure to publish it to your VSTS account’s package-management. I show you how it looks on my Release-job:


This should allow you to build and publish your own Nuget packages to your VSTS Package-Manager. You then can configure the package-manager as an additional source-server in your VisualStudio configuration. Read here how to do this.

marcd View All

I love to write software. More then two decades ago I managed to make my hobby my full-time job so I spent more then 20 year writing professional software (I guess that makes me a "Senior Software Developer"). The last few years I spend most of the time developing in C#/.Net for all kind of windows-, web- and embedded-software.

In my free time I enjoy my family, taking photos and go diving in cold lakes and rivers in Switzerland.

2 thoughts on “How to build and publish Nuget packages with source-symbols to VSTS Leave a comment

  1. Hi Marc, nice read! I was wondering how you would go about package dependencies?
    Say for example I have package A, package B and another package C that has a dependency on A and B.
    I would suspect creating a nuspec file manually for package C and include the dependencies for A and B there, right?
    Or how would you do it? Also, do you know if you can restrict access to the VSTS symbol server?



    • Hi Stan,
      Nuget “pack” does a good job in automatically detecting package dependecies. If all three packages are yours (maybe internal coorp) then I would place a basic .nuspec prepared with variables/placeholders next to each .csproj. Name the .nuspec exactly like the .csproj. Here is a sample content for such .nuspec. Watch for the $…..$ placeholders.


      With this in place Nuget basically does:
      – Add other .csproj in the solution which do have a .nuspec as a package dependency.
      – Add used packages as package dependency.
      – Include other assemblies used in the project directly in the package (if they are not references as a nuget)

      Here is a good doc about it. Check out the chapter “From a VisualStudio Project”:

      About access to symbol server:
      Not sure about this. At least they have the same access-control as your VSTS account.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: