如何关闭所有发布版本的 pdb 生成和 vshost

发布于 2024-08-25 11:48:00 字数 116 浏览 5 评论 0原文

每次启动一个新软件时,我都必须进入配置并关闭 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

随梦而飞# 2024-09-01 11:48:00

经过一番挖掘,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.

独﹏钓一江月 2024-09-01 11:48:00

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

再可℃爱ぅ一点好了 2024-09-01 11:48:00

为什么不添加一个构建后步骤来删除这些您不需要的文件。嗯,这又是一步,不是您想要的:-(

编写一个小帮助应用程序怎么样,它执行 FindFirstFile 和 FindNextFile 循环,在您的发布目录中查找 PDB 和 shost 文件。当它找到它们时,它会删除它们。或者更好仍然将它们移动到存档位置 - 这允许将它们从发布打包问题中删除,但仍然保留文件,以防您需要它们进行错误分析,

另外,因为它是一个帮助应用程序,您只需在预编译过程中运行一次即可。 我们将

这种技术用于很多事情:

  • 确保 DLL 是最新的(基本上是整个构建树的智能更新)
  • 比“批量构建”更好地清理 VC 构建(删除一些可能崩溃的文件) Visual Studio)
  • 以特定方式存档(类似于我为您建议的方式)

我和布莱恩在一起 - 您应该保留这些文件,如果您需要调试任何错误或故障,您将需要这些文件。

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:

  • Ensuring DLLs are up to date (basically an intelligent update for the whole build tree)
  • Cleaning VC builds better than "batch build" can (removing some of those files that can crash Visual Studio)
  • Archiving certain in a particular fashion (similar to what I've suggested for you)
  • etc

I'm with Brian - you should keep these files. If you need to debug any bug or failure, you will need these files.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文