从".exe"中删除调试信息. [英] Remove debug information from an ".exe"

查看:130
本文介绍了从".exe"中删除调试信息.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我将C#程序exe放在文本编辑器中,则可以在其中找到调试信息:

If I put my C# program exe in a text editor, I can find debug information in it:

如何删除它?

我不在乎pdb文件,我只在乎可执行文件中是否存在指向pdb文件的路径.该路径包含我的名字(在本例中为巧合),我的问题是我如何从可执行文件中删除该路径,而不是如何删除pdb文件本身.

I dont care about the pdb file, i only care about that there is a path to the pdb file in the executable. This path contains my name (coincidence in this example), my question is how i can remove THAT Path from the executable, NOT how to remove the pdb file itself.

推荐答案


好吧,所以您的问题实际上是一个好奇的问题,因为您所要的实际上是您通常不会担心的. PDB文件不是个人信息" ,并且都不是是在.exe中指向

文件的路径. /strong>.您的例子纯属巧合.继续...


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...

不要将Visual Studio代码保留在Windows用户配置文件文档文件夹中.而是将其移至以下内容之一

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

  • c:\ development 或更好的是,如果可以的话,请在非OS驱动器上放置一个文件夹
  • 准备好发货时,请确保在CI服务器上构建代码.在这个时代,没有理由不使用CI服务器,就像使用源代码控制一样.
  • 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

这将解决您的exe中出现的用户名巧合的问题.除非您当然是在用户上下文中而不是专用的构建帐户中运行构建代理.

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.

此外,我想保留文档以便保存文档,并且不会被代码污染; Git或SVN缓存.它只会为 CrashPlan 等实时备份应用程序带来噪音.

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.

仅构建没有调试信息.

考虑此默认调试版本,请注意关联的PDB文件的路径:

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

您的用户是一个调试版本,可以通过 PDB 文件的路径来识别该文件,该文件包含有关应用程序的调试信息.通常,您不会部署应用程序的调试版本.

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.

制作您的应用程序的版本版本.默认情况下,发布版本不会生成.pdb文件.

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

此外,如果您担心的话,.pdb文件也不会向狂热的读者透露源代码".它最多可以列出文件的路径,但是文件路径不构成源代码内容.

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.

这篇关于从".exe"中删除调试信息.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆