Here's the deal. I've spent the last several days digging through the Internet looking for a solution to this problem and have basically given up. We have a menu application that loads other apps compiled as dlls using
Assembly myDLL = Assembly.LoadFrom(baseURL + dbDllName + baseDLLextension);
This is not the problem in and of itself. We have many aaps that are loaded this way and when they need to reference thier own app.config, everything works as intended. The problem is I recently had to modify one of these menu apps that references a dll that reference several other dlls, most of which use a configuration file.
I've already included all the necessary values in my app.config file that all the other dlls need. And it runs fine when I run my app as a standalone exe or from the IDE. The problem occurs when my app is loaded from the menu application.
It seems that .Net expects to only read from the execuatbles app.config. I've attempted using the following code, but this fails when my app is loaded from the menu.
System.Configuration.ExeConfigurationFileMap configFileMap = new System.Configuration.ExeConfigurationFileMap();
configFileMap.ExeConfigFilename = @"\\NetworkPath\Folders\My.dll.config";
System.Configuration.Configuration config =
System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(configFileMap, System.Configuration.ConfigurationUserLevel.None);
This does allow me to read the values necessary for the referenced dlls, but it isn't allowing the dlls to read the values.
My last attempt was to manually load all the referenced dlls using Assembly.LoadFrom(), but that gave the same results as all my other attempts. Is what we're trying to do even possible? Has anyone else run into this senario?