ASP.NET deployed site has DEBUG true

I have a deployed ASP.NET site. The parameter compilationfor is debugset to false. I have code that validates the definition debugand reports true.

Why? What do I need to do for this false?

This worked, but since I upgraded my site from .NET 2.0 to .NET 3.5, I have seen this problem. Note that the server has always been .NET 3.5.

Update
As mentioned above, in my web.config file debugthere is false(I understand that the DEBUG preprocessor symbol and the web.config parameter are not connected). In addition, VS2010 Configuration Manager only provides Debug as a configuration for the website, and any attempt to add Release is overwritten by VS2010.

I just realized one more detail; I am using the beta version of SP1 for VS2010. Perhaps this is causing the problem?

+3
source share
3 answers

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) { ... }

+6

"Release" Visual Studio. compilation .

+2

I was able to trace this. Now it seems clear and curious that I know the reason.

When publishing a website, there is an option Emit debug information. Now for me it has shown that a very useful PDB will be emitted, but not the actual debug build. For others, it may seem obvious that this will lead to the creation of Debug, but it was not obvious to me. It didn’t even cross my mind until I started tracking every small change I made in the last update.

+1
source

Source: https://habr.com/ru/post/1792051/


All Articles