Search code examples
c#application-settings

.NET different application settings for development and release


I am using VS2010 C#.NET 3.5 and application settings (the Settings.settings file). What I want to do is have different settings for my development and production environments without having to litter my code with conditional statements checking for debug mode. What is the common approach to this problem?


Solution

  • Or you can just create separate config files and call them:

    Release.settings

    Debug.settings

    then setup conditional build events that copy the appropriate .config file to Settings.Settings

    
    if $(ConfigurationName) == Debug xcopy debug.settings settings.settings
    if $(ConfigurationName) == Release xcopy release.settings settings.settings