Is there any way to set a custom path to Program Database files (*.pdb) in C# under Visual Studio 2008? With C++ this was quite simple (Project settings -> Linker -> Debugging -> Generate Program Database File), but for some reason Microsoft seems to have removed (or hidden) it for C#.
I'm aware that the "standard" usage is to have pdb's located in the bin dir alongside the executable, but that directory is becoming quite a mess so I'd really prefer for them to be located in /obj, which is what I always used to do in C++.
Thanks!
The C# compiler supports this with the /pdb command line option. That option is however not exposed in the IDE's Build tab.
The IDE build process already asks the C# compiler to put the .pdb file in the obj\Debug directory. A copy of it ends up in the bin\Debug by a MSBuild task named CopyFilesToOutputDirectory. This task is configured in Microsoft.Common.targets, a file located in the c:\windows\microsoft.net\framework\v3.5 directory for VS2008. You could technically edit this file and remove the <Copy>
element that copies the .pdb. Heed the warning at the top of file, be sure to make a backup copy before you modify it.
I think the basic problem you'll encounter doing this is that this affects all builds of all projects. And that the debugger now no longer can find the .pdb file. That would be the ultimate show-stopper.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With