Can I add conditions in app.config file?

CharithJ picture CharithJ · Feb 23, 2011 · Viewed 11.2k times · Source

Is it possible to add conditions in app.config file?

I do below in the C# code and I want to do something similar in my app.config file too.

#if (Debug)
.......
#else
.....
#endif

Answer

mellamokb picture mellamokb · Feb 23, 2011

You can try some type of app.config transforms like this: http://fknut.blogspot.com/2009/11/appconfig-transformation-with-new.html.

Or have multiple app.config files like app.config.debug and app.config.release, and use the appropriate one in your build.