如何关闭所有发布版本的 pdb 生成和 vshost
每次启动一个新软件时,我都必须进入配置并关闭 pdb 文件生成和发布版本的 Visual Studio 托管进程。有什么方法可以告诉 Visual Studio(特别是 2008)我想在其余时间对所有项目执行此操作吗?
Every time I start a new piece of software I have to go into the configuration and turn off pdb file generation and the Visual Studio hosting process for Release builds. Is there any way to tell Visual Studio (2008 specifically) that I want to do that for all projects for the rest of time?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
经过一番挖掘,C# 的项目文件似乎存储在
\program files\microsoft Visual Studio 9.0\common7\ide\projecttemplatescache\csharp\windows\1033
中。通过将false
添加到相关模板的正确部分(调试和发布配置有单独的部分),您可以关闭以下所有项目的托管进程所选类型。你应该能够以类似的方式处理 PDB 问题,但正如我所说,我不建议关闭它们,所以我将其作为练习:)
这适用于 VS2008,但我的猜测是其他版本有类似的方案。其实VS2010也采用了同样的做法,不过显然目录中的版本号是10.0而不是9.0。
After some digging around, it appears that project files for C# are stored in
\program files\microsoft visual studio 9.0\common7\ide\projecttemplatescache\csharp\windows\1033
. By adding<UseVSHostingProcess>false</UseVSHostingProcess>
to the correct sections (there are separate sections for Debug and Release configurations) of the relevant templates, you can turn off the hosting process for all future projects of the selected types.You should be able to handle the PDB issue in a similar way, but as I said I don't recommend turning those off, so I'll leave it as an exercise :)
This applies to VS2008, but my guess is that other editions have a similar scheme. In fact, VS2010 uses the same approach, but obviously the version number in the directory is 10.0 instead of 9.0.
在 VS 2010 中,您将在“项目属性”->“项目属性”下找到一个用于控制 .pdb 生成的项目属性。构建->高级...->调试信息
将其设置为“none”以抑制 .pdb 生成。
In VS 2010 you will find a project property to control .pdb generation under Project Properties -> Build -> Advanced... -> Debug Info
Set this to "none" to suppress .pdb generation.
为什么不添加一个构建后步骤来删除这些您不需要的文件。嗯,这又是一步,不是您想要的:-(
编写一个小帮助应用程序怎么样,它执行 FindFirstFile 和 FindNextFile 循环,在您的发布目录中查找 PDB 和 shost 文件。当它找到它们时,它会删除它们。或者更好仍然将它们移动到存档位置 - 这允许将它们从发布打包问题中删除,但仍然保留文件,以防您需要它们进行错误分析,
另外,因为它是一个帮助应用程序,您只需在预编译过程中运行一次即可。 我们将
这种技术用于很多事情:
我和布莱恩在一起 - 您应该保留这些文件,如果您需要调试任何错误或故障,您将需要这些文件。
Why not add a post build step that deletes these files you don't want. Hmm, that still another step, not what you wanted :-(
What about writing a little helper app that does a FindFirstFile and FindNextFile loop looking for PDB and shost files in your release directories. When it finds them, it deletes them. Or better still moves them to an archive location - this allows to remove them from the release packaging issues but still keep the files in case you need them for bug analysis.
Plus because its a helper app you can just run it once as part of your pre-handoff to release staff.
We use this technique for lots of things:
I'm with Brian - you should keep these files. If you need to debug any bug or failure, you will need these files.