如何在Win 7 visual Studio 2012中的C#中禁用#if DEBUG [英] how to disable #if DEBUG in C# at Win 7 visual studio 2012
问题描述
我正在Win 7 visual Studio 2012中使用C#。
I am working on C# in Win 7 visual studio 2012.
我有 #if DEBUG
和我想要禁用它们。但是,当我在Visual Studio中使用无需调试即可启动运行C#时, #if DEBUG
仍然有效。
I have #if DEBUG
and I want to disable them. But, when I run C# in Visual Studio with "start without debugging", the #if DEBUG
is still effective.
任何帮助将不胜感激。
Any help would be appreciated.
UPDATE
在发布版本中构建代码时, #if DEBUG
代码仍然存在,即使它们也没有执行?我需要手动删除它们吗?发布后,我需要将其删除。谢谢!
When I build my code in release, the #if DEBUG
code is still there even though they are nor executed ? Do I need to remove them manually ? I need to get them removed after release. Thanks !
推荐答案
将构建配置从调试更改为发布。
Change your build configuration from Debug to Release.
这篇关于如何在Win 7 visual Studio 2012中的C#中禁用#if DEBUG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!