为什么Visual Studio 2005在发布版中编译时会生成.pdb文件?我不会调试发布版本,那么为什么要生成它们呢?
当前回答
Without the .pdb files it is virtually imposible to step through the production code; you have to rely on other tools which can be costly and time consuming. I understand you can use tracing or windbg for instance but it really depends on what you want to achieve. In certain scenarios you just want to step through the remote code (no errors or exceptions) using the production data to observe particular behaviour, and this is where .pdb files come handy. Without them running the debugger on that code is impossible.
其他回答
实际上,如果没有PDB文件和他们拥有的符号信息,就不可能创建一个成功的崩溃报告(内存转储文件),微软也不会完全了解导致问题的原因。
因此,拥有PDB可以改善崩溃报告。
PDB可以为发布生成,也可以为调试生成。这是设置在(在VS2010中,但在VS2005中必须相似):
项目→属性→构建→高级→调试信息
只需将其更改为None。
调试符号(.pdb)和XML文档(. XML)文件占总大小的很大比例,不应该成为常规部署包的一部分。 但如果需要的话,应该可以访问它们。
一种可能的方法是:在TFS构建过程的末尾,将它们移动到一个单独的工件。
在多项目解决方案中,您通常希望有一个完全不生成PDB或XML文件的配置。与其将每个项目的Debug Info属性更改为none,我认为添加一个仅在特定配置中工作的构建后事件会更方便。
不幸的是,Visual Studio不允许您为不同的配置指定不同的构建后事件。所以我决定手动做这件事,通过编辑启动项目的csproj文件,并添加以下内容(而不是任何现有的PostBuildEvent标记):
<PropertyGroup Condition="'$(Configuration)' == 'Publish'">
<PostBuildEvent>
del *.pdb
del *.xml
</PostBuildEvent>
</PropertyGroup>
不幸的是,这将使后构建事件文本框为空白,在其中放入任何内容都可能产生不可预测的结果。
Without the .pdb files it is virtually imposible to step through the production code; you have to rely on other tools which can be costly and time consuming. I understand you can use tracing or windbg for instance but it really depends on what you want to achieve. In certain scenarios you just want to step through the remote code (no errors or exceptions) using the production data to observe particular behaviour, and this is where .pdb files come handy. Without them running the debugger on that code is impossible.