17

The MSDN documentation does not explain how, when or why this value is set to true.

Setting <configuration debug="false" /> in web.config does not set the property to false, nor does setting <deployment retail="true" /> in machine.config.

I'm running the test website from Visual Studio 2012 on IIS Express, I do not have IIS 'proper' installed.

Edit: After reviewing Oscar's answer and doing some more research, it seems that setting <deployment retail="true" /> should override, so I probably didn't set it in the right framework's machine.config when I asked this question.

Michiel van Oosterhout
  • 22,839
  • 15
  • 90
  • 132

1 Answers1

11

The decompiled code of this property is as follows:

public static bool IsDevelopmentEnvironment
{
    get
    {
        return ((AppDomain.CurrentDomain.GetData(".devEnvironment") as bool?) == true);
    }
}

But I couldn't fin where this value is set.. :-(

Oscar
  • 13,594
  • 8
  • 47
  • 75
  • 11
    Curious, I found this [disassembly of System.Web](http://dotnetinside.com/framework/v4.0.30319/System.Web/ApplicationManager), there is a method `ApplicationManager.EnvironmentInfo.GetWasLaunchedFromDevelopmentEnvironment()`. It looks at the "DEV_ENVIRONMENT" environment variable, if it's set to 1, then the setting is true. – Michiel van Oosterhout Aug 08 '13 at 21:13
  • Here's an [updated link](https://referencesource.microsoft.com/#system.web/Hosting/ApplicationManager.cs,80e692b47a846e09) to the ApplicationManager code. – StriplingWarrior Apr 10 '19 at 22:44