Click here to Skip to main content
15,900,258 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,

Curious problem. I thought this was an easy thing to do but I'm struggling somewhat.

My C# .net 3.5 application solution is made up of a host exe project and a number of other library projects. Obviously my application settings are configured in my host project but I would quite like to adjust some of the user settings (userSettings section group) from within the other projects without having to bother the host exe. The only thing I can find is the ConfigurationManager class but that looks like I have to specify a config file path to access the user configuration. Is there no way to access the user settings without locating the config file?

Cheers,

Chris.
Posted

This article might help you out.

Configuration Files for Class Library Projects[^]

Good luck!
 
Share this answer
 
Comments
TheIdleProgrammer 9-Aug-10 6:03am    
Well that's half way there. I don't really want my assemblies to have their own configuration files, I want them to access the host configuration. Thanks for bringing it to my attention though.
E.F. Nijboer 9-Aug-10 6:12am    
Couldn't you use the context information class for that?
http://msdn.microsoft.com/en-us/library/system.configuration.contextinformation.aspx
TheIdleProgrammer 9-Aug-10 6:26am    
I don't think that's going to help either. I'm thinking I'm going to have no choice at this stage but to raise events from the individual plugin projects and let the host subscribe so it can change the properties, and have the host initialise the plugins with its properties in the first place.
E.F. Nijboer 9-Aug-10 6:39am    
I guess so. Normally a dll does not have a config of its own because it's running on terms of the application that hosts it. This is also a problem when having a website and webserver and want the website to read something from the config of the webservice. There's is also no default solution to do it. (i couldn't find it anyway)
In the end I have used this article as a starting point. it's not what I wanted really, but it's a reasonable compromise.

http://msdn.microsoft.com/en-us/library/ms134265.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900