Search code examples
.netvisual-studio-2013configurationbuild-processconfiguration-files

VS.NET application - Release vs Debug app.config file


Is it possible to set up my build process so that if I build for release (and publish with Clickonce) then the appRelease.config config file would be used with the production database and other settings instead of the debug one?

This would avoid me having to alter these settings in VS2013 whenever I publish


Solution

  • Switching to Release or Debug is grateful because you can use some compiled statements for debug and other for release Example:

    #If Debug Then 
        dim SharedFolder as String ="c:\ApplicationDebugFolder\"
    #Else
        dim SharedFolder as String ="\\ProductionFolder\"
    #End If
    

    I used all the time when I'm developing the application or even I used it to make some test.

    If you select the Debug the compile will only use the code inside of the Debug statement if you select other will use the code inside of the Else statement.