C# 发行版仍有 .pdb 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2371032/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
C# release version has still .pdb file
提问by Abruzzo Forte e Gentile
I want to deploy the release version of my application done in C#.
我想部署在 C# 中完成的应用程序的发布版本。
When I build using the Release
config, I still can see that .pdb
files are produced, meaning that my application can be still debugged. This also means that some debug information is present somewhere in my code, slowing it down a little bit.
当我使用Release
配置构建时,我仍然可以看到生成的.pdb
文件,这意味着我的应用程序仍然可以调试。这也意味着我的代码中某处存在一些调试信息,这会稍微减慢它的速度。
If this is true, how can I completely suppress any debug information produced in the binaries? Do you also know the reason of for having release .pdb
? The Release
configuration has the Optimize code
checked, and only the TRACE
constant is defined, not DEBUG
.
如果这是真的,我怎样才能完全抑制二进制文件中产生的任何调试信息?你也知道有release的原因.pdb
吗?该Release
配置具有Optimize code
检查,并且只有TRACE
常数被定义,而不是DEBUG
。
Thank you for assisting.
谢谢你的帮助。
采纳答案by Marek
If you want to disable pdb file generation, you need to use the "Advanced build settings"
dialog available in project properties after clicking the "Advanced..."
button" located in the lower part of the Build
tab.
如果要禁用 pdb 文件生成,则需要"Advanced build settings"
在单击"Advanced..."
位于Build
选项卡下部的“按钮”后使用项目属性中可用的对话框。
Set Output - Debug info:
to None
for release build configuration and no pdb files will be generated.
设置Output - Debug info:
以None
用于发布版本的配置,没有PDB文件将被生成。
回答by Mehrdad Afshari
回答by Brian Rasmussen
The default is to generate PDBs for release builds as well. That is a feature and you shouldn't disable it. Generating PDBs means you can get more information when debugging. The performance of the code is not affected in any way by the presence of PDB files.
默认情况下也是为发布版本生成 PDB。这是一项功能,您不应禁用它。生成 PDB 意味着您可以在调试时获得更多信息。PDB 文件的存在不会以任何方式影响代码的性能。
回答by Andy Shellam
You don't have to ship the .PDBs with your release deployment, but they are useful to keep around - for example you can remotely debug the code running on a different machine using the PDBs on your machine to get the line numbers of where exceptions occur.
您不必在发布部署中随附 .PDB,但保留它们很有用 - 例如,您可以使用机器上的 PDB 远程调试在不同机器上运行的代码,以获取异常所在的行号发生。
Without the use of the .PDBs, line numbers and file names are not included in stacktraces so it makes it much harder to debug them.
如果不使用 .PDB,行号和文件名将不包含在堆栈跟踪中,因此调试它们变得更加困难。
回答by Justin
You control pdb / symbol generation in the project properties under Build -> Advanced... -> Debug info:. The options are:
您可以在 Build -> Advanced... -> Debug info: 下的项目属性中控制 pdb / 符号生成。选项是:
- none(no symbol information)
- full(a .pdb will be produced, and some symbol information is embedded in the assembly)
- pdb-only(a .pdb will be produced but the assembly is not impacted)
- none(无符号信息)
- full(会产生一个.pdb,在程序集中嵌入了一些符号信息)
- pdb-only(将生成 .pdb 但程序集不受影响)
See http://msdn.microsoft.com/en-us/library/8cw0bt21%28VS.80%29.aspxfor more information.
有关详细信息,请参阅http://msdn.microsoft.com/en-us/library/8cw0bt21%28VS.80%29.aspx。
I stronglyrecommend that you choose the pdb-only option, notthe none option as it still gives you some symbol information without affecting the assembly - you will probably find that this is the current setting you have on your release builds.
我强烈建议您选择 pdb-only 选项,而不是none 选项,因为它仍然为您提供一些符号信息而不影响程序集 - 您可能会发现这是您在发布版本中的当前设置。