When you rebuild the project VS will copy the app.config file to the output
directory and rename it to [AppName.exe].config. This ensures that any
changes that you have made to the default settings through the IDE are
visible to the application when it is run. So if you change the contents of
the [AppName.exe].config file in the output directory the change(s) will be
lost next time you rebuild the application. If, however, you were to change
one of the settings through code while the application is running, assuming
that the setting is user scoped, then when the change is saved it will be
stored in a user.config file and not to the [AppName.exe].config file. For
example, if the following code was run...
Properties.Settings.Default.ServerName = "Value";
Properties.Settings.Default.Save();
.... then the new value for ServerName would be saved, by default, to a
user.config file that should be located similar to the path returned by
"System.Windows.Forms.Application.LocalUserAppData Path".
So the end result is that the settings are loaded from the
[AppName.exe].config file if it exists, otherwise they will be pulled from
the defaults, that were specified in the source code, which were compiled
into the assembly. However, if the value was changed, and saved, through
code then the settings will be loaded from the user.config file. This allows
each user to have their own settings but still be able to resort back to
defaults if necessary. You can find out more from the MSDN help.
"Application Settings for Windows Forms"
http://msdn2.microsoft.com/en-us/lib...6e(vs.80).aspx
--
Tim Wilson
..NET Compact Framework MVP
"Dan" <da*******@bigfoot.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I think i figured it. The file.dll.config needs to be merged with the
exe's config file. why does the IDE create file.dll.config if it needs
to be merged with file.exe.config?
Very unintuitive.
dan
Dan wrote: That method seems to work when the application is an executeable. If i
use this with a dll it doesn't. I have changed the file.dll.config many
times but it always uses the default. Perhaps it is looking for that
value in a different config file.
dan
Dan wrote: The value that is returned is always the value specified by the
attribute DefaultSettingValueAttribute.
The values in the config files (app.config, LibraryConfig.dll.config
in the debug directory and the one of the same name in the exe path)
all have different values.
I have a C# Class Library that gets a setting and is accessed by an vb
exe.
I have been changing the values by every means possible. I have used
the VS IDE and a text editor.
I can seem to find any help on MSDN or google on this either.
Tim Wilson wrote:
How are you changing the value in the config file?