In code, I know to include or exclude certain sections of code based on the currently active build configuration reflected through compiler constants, such as DEBUG
:
static void Main()
{
#if DEBUG
//While debugging this section is used.
#else
//In Release this section is used. This is the "normal" way.
#endif
}
Now I want to do the same in a configuration file, such as web.config or app.config, something like this:
<appSettings>
<!-- IF DEBUG -->
<add key="foo" value="debug-setting" />
<!-- ELSE -->
<add key="foo" value="release-setting" />
<!-- ENDIF -->
</appSettings>
How can I do that?