15

When I compile a .sln file with visual studio 2010 a .pdb file is generated. How can I disable the creation of the .pdb file?

SandyBr
  • 11,459
  • 10
  • 29
  • 27
  • I switched to VS2010 and every time I compile something a .pdb file (which is some MB's big) is generated. I don't want to delete the file every time I have compiled something. I haven't found "Project Properties", "Build", "Advanced..." until now. Even the Release Build is creating a pdb file. – SandyBr Feb 06 '11 at 10:12
  • 6
    i think what @LasseV.Karlsen was saying, Sandy, is that there is generally no need to delete those files. These *Program Database* files contain debugging information, which can be useful to debuggers, users, as well as Windows when your application crashes. While you may find them unsightly, there is no harm in having them. So the answer should be, "Stop deleting them." But i'm curious if you have come across a situation where the files being present is a problem. – Ian Boyd Feb 12 '12 at 16:38
  • @IanBoyd have you "come across a situation where the files being present is a problem" Yes, I just did. The problem is because my visual studio application builds to /users/my.name/... and I don't want my.name included in the .exe file, but it is. Of course I could build to a different directory. This is what appears in the .exe file "C:\Users\my.name\Documents\Visual Studio 2010\Projects\myproject\x64\Release\myproject.pdb" I work for a company, and I don't want my personal information in the published software. – jester Apr 25 '18 at 11:43

1 Answers1

24

There is an option in the "Project Properties", "Build", "Advanced...".

Change "Debug Info:" to None.

However, you should only do this if you are sure you don't need them.

It might be better to keep the PDB files, and just copy over the files that you need.

Before changing the setting, please read this.

DaveShaw
  • 52,123
  • 16
  • 112
  • 141
  • 1
    I followed this advice and encountered problems: Namely, without the pdb, VS2010 eventually began to refuse breaking properly on exceptions, and would want to show disassembled code for my own classes while claiming that no symbols are loaded. It appears the pdbs are necessary for resolving stack traces when an exception occurs, so that it can automatically take you to the generating line. – Superbest Mar 10 '12 at 15:23
  • 1
    See the comments under the question :) – DaveShaw Mar 10 '12 at 17:49
  • If you are referring to Ian Boyd's comment, to an inexperienced programmer it had not been sufficiently clear. When I read, "which can be useful to debuggers", I assumed that if I don't know what he's even talking about, it won't affect me. I eventually found out he made a massive understatement. "Can be useful to debuggers" is not the same as "good luck figuring out why **any** exception is happening without it". Hence I felt the need to comment. – Superbest Mar 10 '12 at 19:48
  • 1
    @Superbest This is not advice. It is merely an answer to your question. Advice would be do not use this option even if it is available. – Sam Harwell Apr 24 '13 at 13:45
  • Dear future readers: Due to @280Z28 's complaint, please imagine that I wrote "*these instructions*" instead of "this advice". Apologies for the inconvenience. (Also if you want to be pedantic, I didn't ask a question, I made a comment.) – Superbest Apr 30 '13 at 22:04