Config file in dll project?
-
I want to keep a connection string in a config file in a DLL project. I have tried using myappname.dll.config and app.config and have stored the data like this... and try to retrieve this data using... strConnectionString = ConfigurationSettings.AppSettings["constring"]; I'm only getting null back. The application doesn't seem to be able to see the config file. ConfigurationSettings.AppSettings.Keys.Count is zero. ConfigurationSettings.AppSettings.Count is zero. Can anyone tell me why this is not working? Thanks in advance - Dave
-
I want to keep a connection string in a config file in a DLL project. I have tried using myappname.dll.config and app.config and have stored the data like this... and try to retrieve this data using... strConnectionString = ConfigurationSettings.AppSettings["constring"]; I'm only getting null back. The application doesn't seem to be able to see the config file. ConfigurationSettings.AppSettings.Keys.Count is zero. ConfigurationSettings.AppSettings.Count is zero. Can anyone tell me why this is not working? Thanks in advance - Dave
Configuration files seems to be intended for applications, not for libraries.
ConfigurationSettings
is just a wrapper aroundXmlDocument
You can easily write your own (and provide abstract API, so you can extend or re-implement it in case you figure out some better way how to do it). David Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy -
I want to keep a connection string in a config file in a DLL project. I have tried using myappname.dll.config and app.config and have stored the data like this... and try to retrieve this data using... strConnectionString = ConfigurationSettings.AppSettings["constring"]; I'm only getting null back. The application doesn't seem to be able to see the config file. ConfigurationSettings.AppSettings.Keys.Count is zero. ConfigurationSettings.AppSettings.Count is zero. Can anyone tell me why this is not working? Thanks in advance - Dave
Because .DLL projects can't have config files. Since the .DLL becomes part of the host application using it, any code you write like this in the .DLL will use the host applications config file. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome