Remove debug information from an “.exe” [duplicate]

人盡茶涼 提交于 2019-12-01 23:48:09
MickyD

OK, so yours is actually a curious question because what you are asking for is really nothing you normally would be concerned about. PDB files are not "personal information" and neither is the path found in the .exe that points to the .PDB file. Your example is pure coincidence. Moving on...


Easiest fix Based on Best Practices

Don't keep your Visual Studio code inside your Windows User Profile Documents folder. Instead move it to one of the following

  • c:\development or better yet, a folder on a non-OS drive if you can
  • When you are ready to ship, ensure you build your code on a CI server. In this day and age there is no excuse for not using a CI server in the same way as you should be using source control

That will fix the coincidental username appearing in your exe. Unless of course you are running your build agent in your user context instead of a dedicated build account.

Also, I like to keep Documents for, well documents and not get polluted with code; Git or SVN caches. It just creates noise for real-time back-up apps like CrashPlan.

Alternative

Just build without debug information.

Consider this default debug build, note the path to the associated PDB File:

Release with No debug settings

Settings

Yours is a debug build which you can tell by the path to the PDB file, a file containing debug information about the application. Normally you don't deploy a debug build of your application.

Make a release build of your application. Release builds by default do not generate a .pdb file.

Also, .pdb files don't give away "source code" to avid readers if that is your fear. At most it may list the path to a file, but a filepath doesn't constitute source code content.

See also:

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!