Alex Rivera | Logout

Can I add conditions in app.config file?

Asked 2011-02-23T04:50:58.777
20

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
Edit
Report

1 Answer

2

You should be able to do something like this programatically, by putting the relevant sections in two different config files, then at app-start time, load the appropriate config file. The majority of your config would be in the main app.config, and there would be a second config file for the rest.

I don't have the syntax offhand, but it's basically the same idea as having a user.config with user-specific configurations.

answered 2011-02-23T05:00:01.553

Your Answer