views:

87

answers:

2

I'm using Visual Studio 2010. In my Solution Explorer I like to sort my Project items into folders (a folder for Forms, a folder for Classes, a Misc folder, etc.)

It seems though that if I move the "app.config" file to a folder named "Config Files" everything works until I change a setting in the Settings.settings file. Once I do that, a new app.config is created and the one that was in the "Config Files" folder did not get updated.

I have searched the entire solution for the text "app.config" and did not find any results. How can I move this file so that my Solution Explorer looks nice and clean?

+1  A: 

No, the app.config has to be in the main project folder - but you can "externalize" any configuration section inside the app.config by using the configSource= attribute:

<connectionStrings configSource="config\db\connectionstrings.config" />
<system.net>
  <mailSettings>
    <smtp configSource="config\mail\smtp.dev.config" />
  </mailSettings>
</system.net>
<system.serviceModel>
    <behaviors configSource="config\wcf\behaviors.config" />
    <binding configSource="config\wcf\bindings.config" />
    <client configSource="config\wcf\client.config" />
</system.serviceModel>
marc_s
+1  A: 

AFAIK, you cannot change the location of the default configuration file. Although if you need another configuration file, you can make use of ExeConfigurationFileMap class.

danish