If I have a class library with an app.config
file (I know it\'s not ideal, just bear with me for a moment) which has settings values created by using the projects S
but that returns the application's config file. How can I determine which .config file the library is reading from when it calls My.Settings...?
By default, it will be always the main.exe.config
.
Take a look at this for detailed answer C# DLL config file for more informations
You can use external config files. This article on MSDN explains how.
EDIT
You're misunderstanding the situation, reread this line: The settings from the app.config file of the library project are definitely not copied into the app.config file of the application but I can sti retrieve the My.Settings from the libraries app.config.
You are correct. Your settings in the dll.config will not be copied automatically in the app.config.
Concerning the value that you are able to get from your dll, I am still looking for more official answer, but the answer seems to be:
the 'old' values (the ones you define at development time) are hard coded. If the franework isn't able to access or open the config file it will use the defaults instead. This will always happen if you use settings in a dll.
Take a look at this Settings.Default.