How to modify library-specific settings in referencing applications

D

dhochee

I understand that settings stored in the app.exe.config file and
accessed via Properties.Settings.Default are only available within an
app domain, but I'm confused about the best way to handle merging
settings that were defined for referenced libraries.

For example, we have a connection string which is stored as a setting
in a library project referenced by several application projects. The
setting was created automatically when we created a dataset within the
library project. We would like to be able to modify the connection
string in a single location so that we can easily switch the data
source. We have developers in multiple locations, using different
databases (including local copies). It would be ideal if they could
make a small modification to a single file after updating from source
control, without recompiling the library. Right now they have to open
the library project, change the connection string and recompile, even
though they're only consumers of the library.

I suspected that the solution would involve a merging of the
library.dll.config file with the corresponding app.exe.config file,
but I haven't found a simple way to achieve this. Perhaps there's a
completely different approach that will work.

Any ideas?

- Dan
 
N

Nicholas Paldino [.NET/C# MVP]

Dan,

Well, if you have a "library.dll.config" file, then I don't see how you
are using the config classes that are in the framework, as that only works
on the config file for the hosting executable.

You should be able to create a custom configuration section, as
described here:

http://msdn2.microsoft.com/en-us/library/2tw134k3.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top