Now I realized that Emit Debug Information not only creates PDB files, but also allows you to use any code that runs in the #if DEBUG clause (as if compiling debug = true in web.config). This compilation option does not affect other projects in your solution if it is compiled in Release mode.
PDB - DEBUG, - Emit Debug Information - compilerOptions = "/debug: pdbonly" web.config. /optimize -, , ,
:
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
compilerOptions="/optimize- /debug:pdbonly">
<providerOption name="CompilerVersion" value="v3.5" />
<providerOption name="WarnAsError" value="false" />
</compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5" />
<providerOption name="OptionInfer" value="true" />
<providerOption name="WarnAsError" value="false" />
</compiler>
</compilers>
</system.codedom>
- PDB, DEBUG, DEBUG if (Consts.DEBUG).
App_Code CS, :
public static class Consts
{
static bool _bIsInDebugMode = false;
static Consts()
{
var oConfigSection = System.Configuration.ConfigurationManager.GetSection("system.web/compilation") as System.Web.Configuration.CompilationSection;
_bIsInDebugMode = oConfigSection != null && oConfigSection.Debug;
}
public static bool DEBUG { get { return _bIsInDebugMode; } }
}
#if DEBUG ... #endif if (Consts.DEBUG) { ... }