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.