Is anyone aware of a way that I can set application (or user) level settings in a .Net application that are conditional on the applications current development mode? IE: Deb
I know this was asked years ago, but just in case anyone is looking for a simple and effective solution that I use.
Go to project properties, Settings tab (you'll see your web service URL or any other settings already listed here).
Click the "View Code" button available on the Settings page.
Type this in the constructor.
this.SettingsLoaded += Settings_SettingsLoaded;
Add the following function under the constructor:
void Settings_SettingsLoaded(object sender, System.Configuration.SettingsLoadedEventArgs e)
{
#if(DEBUG)
this["YOUR_SETTING_NAME"] = VALUE_FOR_DEBUG_CONFIGURATION;
#else
this["YOUR_SETTING_NAME"] = VALUE_FOR_RELEASE_CONFIGURATION;
#endif
}
Now whenever you run your project, it will compile only the line that matches the current build configuration.