C # - Set pdb path

Is there a way to set my own path to program database files (* .pdb) in C # in Visual Studio 2008? With C ++, it was pretty simple (project settings -> Linker -> Debugging -> Generate Program Database File), but for some reason Microsoft seems to have deleted (or hidden) it for C #.

I know that the β€œstandard” use is that pdb is in the bin directory along with the executable, but this directory becomes pretty messy, so I would prefer that they be located in / obj, which is what I always did in C ++.

Thanks!

+4
source share
3 answers

The C # compiler supports this using the / pdb command line . However, this option does not appear on the Create IDE tab.

The IDE build process already asks the C # compiler to place the .pdb file in the obj \ Debug directory. Its copy ends in bin \ Debug with an MSBuild task named CopyFilesToOutputDirectory. This task is configured in the Microsoft.Common.targets file, a file located in the c: \ windows \ microsoft.net \ framework \ v3.5 directory for VS2008. You can technically edit this file and delete the <Copy> element that copies .pdb. Note the warning at the top of the file, be sure to make a backup before changing it.

I think that the main problem that you will encounter is that this affects all builds of all projects. And that the debugger can no longer find the .pdb file. This will be the ultimate show stopper.

+2
source

add a postbuild event and copy pdb to the right place)

0
source

The .pdb files must be in the same folder as your .exe and .dll to load.

Pdb files are loaded during exception handling and are needed to track the return line in the exact line of code where your exceptions occur.

What you can do is move pdb to the character server at build time, rather than publish them using the application. Then insert them when analyzing the exception path.

Check out this post for info on pdb files, character servers, etc.

0
source

All Articles