ConfigurationManager.AppSettings collects a configuration file for the AppDomain you download. This configuration file is usually the one associated with the entry point executable. In your case, you do not control the entry point executable file and do not start the AppDomain application, so you cannot use ConfigurationManager.AppSettings.
Basically you ask the question: "How can I create a configuration file associated with a DLL?" ( C # Dll configuration file ). You need to do two things:
- Add the application configuration item to your project and make sure that you deploy it to the same folder as your DLL.
Access the configuration file from your DLL using the following code:
string pluginAssemblyPath = Assembly.GetExecutingAssembly().Location;
Configuration configuration = ConfigurationManager.OpenExeConfiguration(pluginAssemblyPath);
string someValue = configuration.AppSettings.Settings["SomeKey"].Value;
DLL , . , VS . , , DLL, .