Debug.WriteLine在哪里会在C#输出到build时发布? [英] Where will Debug.WriteLine in C# output to when build release?
问题描述
当我准备好发布时,这些Debug.Write会影响发布版本,它们在哪里输出?
从 MSDN :
ConditionalAttribute属性适用于Debug的方法,支持ConditionalAttribute的编译器忽略对这些方法的调用,除非将DEBUG定义为条件编译符号,请参考编译器的文档来确定ConditionalAttribute被支持和用于定义条件编译符号的语法。
所以如果您的发行版配置不包括DEBUG符号,则在编译期间将会省略Debug.WriteLine调用将不会输出。
I put a lot of Debug.WriteLine in my code for debug purposes. When I am ready to build for release, will these Debug.Write influence the release build, and where do they output to?
From MSDN: "The ConditionalAttribute attribute is applied to the methods of Debug. Compilers that support ConditionalAttribute ignore calls to these methods unless "DEBUG" is defined as a conditional compilation symbol. Refer to a compiler's documentation to determine whether ConditionalAttribute is supported and the syntax for defining a conditional compilation symbol."
So if your release configuration does not include DEBUG symbol the Debug.WriteLine calls will be omitted during compilation and there will be no output.
这篇关于Debug.WriteLine在哪里会在C#输出到build时发布?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!