building a app.config file in a control (dll)
-
An exe generates a myexe.exe.cfg file by default. However, if I add a app.config to a dll it does not generate a similar file. I would like my control (derived from Label) to have it's own key/value configuration file. Thanks Phil
-
An exe generates a myexe.exe.cfg file by default. However, if I add a app.config to a dll it does not generate a similar file. I would like my control (derived from Label) to have it's own key/value configuration file. Thanks Phil
-
An exe generates a myexe.exe.cfg file by default. However, if I add a app.config to a dll it does not generate a similar file. I would like my control (derived from Label) to have it's own key/value configuration file. Thanks Phil
You may also find this article useful http://www.codeproject.com/useritems/CustomConfigurationMgr.asp?msg=1930993&mode=all&userid=16070#xx1930993xx[^] As well as my comments to it public class MyAssembly { public string GetValue() { System.Reflection.Assembly asm = System.Reflection.Assembly.GetAssembly(this.GetType()); ExeConfigurationFileMap map = new ExeConfigurationFileMap(); map.ExeConfigFilename = System.IO.Path.GetFileName(asm.CodeBase) + ".config"; Configuration config = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None); return config.AppSettings.Settings["TestKey"].Value; } } In Windows or web app MyAssembly asm = new MyAssembly(); string value = asm.GetValue();
only two letters away from being an asset