There are two projects in my solution, one is utility dll and the other is the main executable. I have user settings in the exe project. However I want to read the settings in the utility dll so that the utility dll can be reused in other projects but generate project- specified results. The scenario would be namespace dll { static class StringGenerator { static public string ProjectSpecifiedString() { return String.Format("{0} is project specified.", Assembly.GetExecutingAssembly()... /*The answer to my question!*/); } } }
On Jul 17, 6:38 pm, Wayne wrote: > There are two projects in my solution, one is utility dll and the > other is the main executable. I have user settings in the exe project. > However I want to read the settings in the utility dll so that the > utility dll can be reused in other projects but generate project- > specified results. The scenario would be > > namespace dll > { > static class StringGenerator > { > static public string ProjectSpecifiedString() > { > return String.Format("{0} is project specified.", > Assembly.GetExecutingAssembly()... /*The answer to my question!*/); > } > } > > > > }- Hide quoted text - > > - Show quoted text - You can access the configuration and the settings from any project. it can be only defined in the "main" project. A little explanation. The ConfigurationManager is a static class so it's available to ANY class in the AppDomain and it will be the same isntance. As your dll runs in the same AppDomain than the code that included and loaded the configuration you can use it.