Visual Studio 中的发布模式和调试模式有什么区别?

发布于 2024-07-22 21:30:03 字数 313 浏览 5 评论 0原文

可能的重复:
.NET 中的调试与发布
调试/发布差异

构建项目时 Visual Studio 中的发布模式和调试模式有什么区别?

Possible Duplicate:
Debug vs. release in .NET
Debug/Release difference

What is the difference between Release and Debug modes in Visual Studio while building a project?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

ぃ双果 2024-07-29 21:30:06

主要区别是在调试模式下编译时,还会创建允许调试的 pdb 文件(因此您可以在运行时单步执行代码)。 然而,这意味着代码没有得到充分优化。

The main difference is when compiled in debug mode, pdb files are also created which allow debugging (so you can step through the code when its running). This however means that the code isn't optimized as much.

预谋 2024-07-29 21:30:05

嗯,这取决于您使用的语言,但通常它们是 2 个独立的配置,每个配置都有自己的设置。 默认情况下,“调试”在编译文件中包含调试信息(允许轻松调试),而“发布”通常启用优化。

就条件编译而言,它们各自定义了可以在程序中检查的不同符号,但它们是特定于语言的宏。

Well, it depends on what language you are using, but in general they are 2 separate configurations, each with its own settings. By default, Debug includes debug information in the compiled files (allowing easy debugging) while Release usually has optimizations enabled.

As far as conditional compilation goes, they each define different symbols that can be checked in your program, but they are language-specific macros.

长安忆 2024-07-29 21:30:04

调试发布只是不同解决方案配置的标签。 如果需要,您可以添加其他人。 我曾经参与的一个项目有一个名为“调试内部”的项目,用于打开应用程序的内部编辑功能。 如果您转到Configuration Manager...(位于Build 菜单上),您可以看到这一点。 您可以在配置管理器对话框下找到有关 MSDN Library 的更多信息。

每个解决方案配置都包含一堆项目配置。 同样,这些只是标签,这次是项目设置的集合。 例如,我们的 C++ 库项目具有名为“Debug”、“Debug_Unicode”、“Debug_MT”等的项目配置。

可用的设置取决于您正在构建的项目类型。 对于 .NET 项目来说,这是一个相当小的集合:#define 和其他一些东西。 对于 C++ 项目,您需要调整的内容要多得多。

不过,一般来说,当您希望在关闭优化器的情况下构建项目时,以及当您希望在构建中包含完整的调试/符号信息(通常在 .PDB 文件中)时,您将使用“调试”。 当您想要打开优化器以及想要包含完整的调试信息时,您将使用“发布”。

Debug and Release are just labels for different solution configurations. You can add others if you want. A project I once worked on had one called "Debug Internal" which was used to turn on the in-house editing features of the application. You can see this if you go to Configuration Manager... (it's on the Build menu). You can find more information on MSDN Library under Configuration Manager Dialog Box.

Each solution configuration then consists of a bunch of project configurations. Again, these are just labels, this time for a collection of settings for your project. For example, our C++ library projects have project configurations called "Debug", "Debug_Unicode", "Debug_MT", etc.

The available settings depend on what type of project you're building. For a .NET project, it's a fairly small set: #defines and a few other things. For a C++ project, you get a much bigger variety of things to tweak.

In general, though, you'll use "Debug" when you want your project to be built with the optimiser turned off, and when you want full debugging/symbol information included in your build (in the .PDB file, usually). You'll use "Release" when you want the optimiser turned on, and when you don't want full debugging information included.

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