我应该如何在Visual Studio中使用调试/发布模式? [英] How should I use debug/release mode in Visual Studio?

查看:114
本文介绍了我应该如何在Visual Studio中使用调试/发布模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常在我的工作计算机上本地测试代码,然后将其移至开发环境,最后移至生产环境.在这种情况下,使用调试/发布模式的最佳方法是什么?我只需要关心机器中的调试模式吗?我应该发布调试模式还是发布模式进行开发?我知道可能应该使用发布模式发布到生产环境.之前我并没有真正注意所有这些事情,所以我一直一直只在调试模式下工作,我知道我不应该这样做.

I usually test my code locally on my work machine and then move it to development environment and then finally to production environment. What is the best way to use debug/release mode for this scenario? Do I only need to care about debug mode in my machine? Should I publish debug mode or release mode to development? I know probably I should publish using the release mode to production. I didn't really pay attention to all of this before so I have been working only in debug mode all the time, which I know I shouldn't.

感谢您的回答.似乎仅在自己的计算机上使用调试模式是一个好主意.即使它在开发机器中,它也基本上是向公众发布(同事,质量保证),因此它应该处于发布模式.当然,发布到产品时应该是发布模式.

Thanks for the answers. It looks like it's a good idea to only use debug mode in my own machine. Even though it's in development machine, it's basically releasing to the public (co-workers, qa) so it should be in release mode. And of course it should be release mode when releasing to prod.

推荐答案

发布/发布应用程序时,应在发布"模式下进行.释放模式仅用于释放应用程序.生成的代码通常性能更高,并且许多代码会删除许多与应用程序开发阶段相关联的检查.

When releasing / publishing an application you should do so in Release mode. Release mode is for just that, releasing applications. The code produced is typically more performant and many removes many checks that are more associated with the development phase of an application.

通常,您应该在Debug模式下进行开发.大多数语言都会在调试模式的应用程序中插入额外的检查.这些漏洞更多,但往往会使应用程序变慢.

In a typical day, you should be developing in Debug mode. Most languages insert extra checks into a debug mode application. These spot more bugs but tend to slow down the application a bit.

但是,作为开发过程的一部分,您还必须对发布模式进行重大测试.客户实际上只会看到产品的发布模式版本,并且错误可能是特定于调试/发布模式的.以调试模式插入的错误检查会带来副作用,这些副作用会在您的应用程序中隐藏真正的错误.

Yet you must also do siginificant testing of Release mode as part of your development process. Customers will only actually see the Release mode version of your product and it's possible for bugs to be Debug / Release mode specific. The bug checks inserted in debug mode can introduce side effects that hide real bugs in your application.

这篇关于我应该如何在Visual Studio中使用调试/发布模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆