Reputation: 2375
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?
Upvotes: 24
Views: 5666
Reputation: 524
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.
Upvotes: 15
Reputation: 17808
If you switch them to Trace.WriteLine
you can define arbitrary listeners in the app/web.config file.
Upvotes: 8
Reputation: 20357
Debug.WriteLine
is annotated with the Conditional
attribute. (see MSDN)
The ConditionalAttribute tells the compiler not to generate that code unless the DEBUG
flag is supplied.
Upvotes: 19