There are a few ways to do this that come time mind:
The first is in debug/release mode, use different key names.
You app.config would look like
<add key='option1' value='do it the easy way'/>
<add key='option1_debug' value='do it the hard way'/>
.... and inside your code, have a single entry/exit point for looking up key
value.
That code will say:
string keyValue = passedInKeyValue
#if Debug
keyValue = keyValue + "_debug";
#end if
return ConfigurationManager.AppSettings[keyValue];
That would work with no trouble.
Another option is to use a custom app domain. When you create a new
application domain, you get to specify the name & location of the config
file. You could have a "loader" app domain in your Main(), that says,
AppDomain d = new AppDomain()
#if DEBUG
d.ConfigPath = "debug.config";
#else
d.ConfigPath="release.config";
#end if
.... and all your "real" code runs in this new app domain.
--
Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
http://www.coversant.com/blogs/cmullins
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello there,
>
> is there a possibility to use different configurations for debug and
> release mode?
>
> I need other settings in debug mode than in release mode but do not
> want to replace the web.config all the time manually.
>
> Regards,
> Norbert
>