Visual Studio 中的发布模式和调试模式有什么区别?
可能的重复:
.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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
主要区别是在调试模式下编译时,还会创建允许调试的 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.
嗯,这取决于您使用的语言,但通常它们是 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.
调试和发布只是不同解决方案配置的标签。 如果需要,您可以添加其他人。 我曾经参与的一个项目有一个名为“调试内部”的项目,用于打开应用程序的内部编辑功能。 如果您转到
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 theBuild
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:
#define
s 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.