tags:

views:

116

answers:

3

What is a PDB file and how can I exclude it from the release folder when I rebuild my solution?

+3  A: 

A pdb file contains information used by the debugger. It is not required to run your application and it does not need to be included in your released version.

You can disable pdb files from being created in Visual Studio. If you are building from the command line or a script then omit the /debug switch.

Mark Byers
Release mode still builds PDBs by default, I believe. You can change the project properties to disable it though.
Jon Skeet
Yup; it still comes with release with a default project.
Andrew Barber
I just checked and I also get one by default if using Visual Studio.
Mark Byers
+8  A: 

A pdb file contains information for the debugger to work with. There's less information in a Release build than in a Debug build anyway, but if you want it to not be generated at all, go to your project's Build properties, select the Release configuration, click on "Advanced..." and under "Debug Info" pick "None".

Jon Skeet
@Jon Does it help provide extra information to the user if the application crashes in use? (ie, does it help with the JIT window, rather than "This program needs to end, send a Windows Error Report")
Jared Harley
Bear in mind that you should probably keep these included in your debug releases, as it allows exceptions to be traced to a specific line in your code. Without the symbols in the pdb file, you will find it hard to pinpoint specific problems in order to solve them. You don't necessarily need to exclude them from release builds either, as sometimes the extra information in a big report can be very useful.
JD
@Jared: Yes, it includes a stack trace of the exception, which will pinpoint to a specific function and line of code.
JD
@Jared: What do you mean by "the JIT window"? It's unlikely to give much more information to the user, but it may let you attach a debugger to a release build if you need to. Typically you wouldn't include it for end-user applications though. Of course, just because it's copied to the Release folder doesn't mean you have to ship it in the installer...
Jon Skeet
@Jon if I include PDF file with my software installer , does it make problem or does it make anyway for hacker ?
Ata
@Ata: PDB, not PDF. Please separate the two in your mind - they're *completely* different file formats, for different purposes. Including a PDB wouldn't introduce a problem particularly; it *may* make a hacker's job *slightly* easier, but is that a particular concern for you? In general, .NET can be decompiled relatively easily in most cases - if you're worried about that, simply not shipping the PDB isn't a good solution.
Jon Skeet
@Jon The JIT window I was talking about is the "just in time debugging" message window, [like this one](http://byfiles.storage.msn.com/y1p14Fi8wY6Pt4cEeG-S79_GBkualYXD_zQ1uZARQsOc2RViJSqwtUyjVPD6e6SD_pmoOHey4ocbDmlc9w4O1YNuQ?PARTNER=WRITER)
Jared Harley
@Jared: Right... to avoid confusion it's probably worth talking about the standard crash dialog, or something like that - as JIT normally just refers to the just-in-time *compiler*, not *debugger*.
Jon Skeet
A: 

See Microsoft document: Description of the .PDB files and of the .DBG files

Bobj-C