Is the fact that this defeats the goal of removing it from <compilation>
From MSDN C # Compiler Options
To open debug , the flag in the compiler is /debug , not /define:Debug=True
/ debug: Ask the compiler to fix the debug information.
/ define: Defines preprocessor characters.
So, when you define Debug=True , you only do this code code:
#if DEBUG == true // Compile what is inside here !
/define:Debug=True does not add additional debugging information unless you include a manual with the above code in it.
Testing Page
I use the following code to run tests and view events.
txtDebug.Text = HttpContext.Current.IsDebuggingEnabled.ToString(); #if DEBUG txtDebug.Text += "<br>defined Debug is on"; #endif #if DEBUG == true txtDebug.Text += "<br>defined Debug = true is on"; #endif
Result 1
Now, if debug="false" and with compilerOptions="/define:Debug=True" results
falsely
specific Debug = true enabled
Result 2
if debug="true" and compilerOptions="/define:Debug=True" resuls
right
a specific debugger is on
specific Debug = true enabled
Result 3
Now I am doing another test, I am adding this line to web.config
<compiler language="c#;cs;csharp" extension=".cs" compilerOptions="/define:Debug=True /D:DEBUG,TESTFLAG" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4" />
And the results with debug=false
False (debug is false)
defined debug enabled (but defined debug is now running)
defined by Debug = true enabled (this also runs)
test flag (but a specific optional flag is also triggered)
MSDN
Looking at the MSDN for / define (preprocessor definition) I look at the declaration
/define:Debug=True
only works for this code case
#if DEBUG == true txtDebug.Text += "<br>defined Debug = true is on";