Include .pdb files in Web Application Publish for Release mode (VS2012)

While most people want to get rid of the pdb files in release mode, I want to keep them. They don’t impact the performance of the application. They offer very useful information when exceptions occur. Etc..

In Visual Studio 2012, the .pdb files where excluded when publishing web applications in release mode.The development of these web applications was started in Visual Studio 2010 and I never had this problem. Somehow something changed after the solutions/projects very opened in VS2012.

Under the Project Properties > Build > Advanced, the ‘Debug Info’ was still set to ‘pdb-only’. So building in release does create the .pdb files.
However, when running the ‘publish’ to deploy to file system (in context menu of the project, under the build menu) the .pdb files are not copied.
They don’t appear on the destination folder which makes sense because they aren’t even copied to the ‘obj\Release\Package\PackageTmp\bin’.
But why are they not copied to the package folder?

Like a lot of things, the answer is very simple and the solution even more so.
After digging around, I noticed a new option in Visual Studio 2012 for Web Publish: exclude generated debug symbols.
New option? Ok, not really. I just never saw it before. Turns out was there in Visual Studio 2010 also. But when converting my projects, this option got enabled somehow.

You can find this option under the Project Properties > Package/Publish Web.
Just uncheck the checkbox “Exclude generated debug symbols” and your .pdb files will be published like before.

‘Exclude generated debug symbols’ checkbox to include .pdb files in your publish.

Great, I’ve got my useful info back in the stack trace of exceptions! And so do you I hope.