Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I want to share a single app.config during development, with different class libraries and one executable. Can somebody help to give me a clearly examble over that?
Posted
Comments
Christian Amado 30-Aug-12 8:25am    
What means "share" here?
Member 4710969 30-Aug-12 8:31am    
That's mean you can use one app.config within 2,3 or mroe projects.

1 solution

You can "share" an app.config file. You must add the app.config in one dll, so you will have access to it via Settings.

For example,
-Project1
- App.config
- Settings.Setting
-Project2
- Project1.Settings.Setting.Name_of_the_atribute
-Project3
- Project1.Settings.Setting.Name_of_the_atribute

Let me know if you have more questions.

Hope it helps.
 
Share this answer
 
Comments
Member 4710969 30-Aug-12 8:42am    
Thanks for your quick answer. I will try it now.. then I will give you my feedback.
Member 4710969 30-Aug-12 9:44am    
Hi Christian,
Can you please more explain in codes, for example:
- I added app.config to The ClassLibrary,
- I add reference of the ClassLibrary to Project1
- How can I access to the app.config from ClassLibrary via Project1?
I did like that:
ClassLibrary.Properties
But never helpt
Christian Amado 30-Aug-12 9:56am    
Right click on your classlibrary, then navigate trough settings and add some settings there :) After that you can do what you post above.
Member 4710969 3-Sep-12 7:57am    
Thanks Christian, this is very helpful.
Now I have another question:
Can I modify the app.config during the RUN in dll?
If yes, would you please help me?
Christian Amado 3-Sep-12 8:06am    
Yes, you can. http://chiragrdarji.wordpress.com/2008/09/25/how-to-change-appconfig-file-run-time-using-c/
or
http://sufianrashid.wordpress.com/2011/10/17/c-modify-app-config-file-at-run-time/

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