Home All Groups Group Topic Archive Search About

Saving appSettings when using file=

Author
29 Aug 2006 12:56 AM
deangelj
I have an app.config that looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings
     file="External.config" >
  </appSettings>
</configuration>

And External.config contains all my settings,  e.g.

<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
  <add key="setup WebType" value="IIS" />
  <add key="setup UseEPG" value="Y" />
</appSettings>

The trouble is, when I update some settings and do a Configuration.Save()
the settings are written back to the app.config and not External.config. Is
this a bug, design feature, or is there a setting to alter this behaviour?
Using .NET 2

Thanks,
John

Author
31 Aug 2006 8:31 AM
Miha Markic [MVP C#]
Hi,

The better approach would be to use Application Settings (see .net help
topics).

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Show quote
"deangelj" <deangelj@usergroups.nospam> wrote in message
news:38081252-76DD-499B-A214-514A28CCB897@microsoft.com...
>I have an app.config that looks like this:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
>  <appSettings
>     file="External.config" >
>  </appSettings>
> </configuration>
>
> And External.config contains all my settings,  e.g.
>
> <?xml version="1.0" encoding="utf-8" ?>
> <appSettings>
>  <add key="setup WebType" value="IIS" />
>  <add key="setup UseEPG" value="Y" />
> </appSettings>
>
> The trouble is, when I update some settings and do a Configuration.Save()
> the settings are written back to the app.config and not External.config.
> Is
> this a bug, design feature, or is there a setting to alter this behaviour?
> Using .NET 2
>
> Thanks,
> John
Author
31 Aug 2006 12:09 PM
deangelj
Hi Miha,

Not sure how this would help. I'm using the file= syntax so I can share the
config file between 3 different apps that I'm shipping. I can embed the
settings in specific config files per app but then I need to update all 3.
How does Application Settings help me in this case?

thanks,
John

Show quote
"Miha Markic [MVP C#]" wrote:

> Hi,
>
> The better approach would be to use Application Settings (see .net help
> topics).
>

AddThis Social Bookmark Button