OK, in the end, I managed to hack something together that works for me. Perhaps this will help;
Using Assembly.GetExecutingAssembly, from a DLL that has a configuration file that I want to read, I can use .CodeBase to find where the DLL was before I launched the new AppDomain for this. * .dll .config is in the same folder.
Then you need to convert the URI (as .CodeBase looks like "file: //path/assembly.dll") to get the LocalPath for the ConfigurationManager (which does not like Uri formatted strings).
try { string assemblyName = Assembly.GetExecutingAssembly().GetName().Name; string originalAssemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase); Uri uri = new Uri(String.Format("{0}\\{1}.dll", originalAssemblyPath, assemblyName)); string dllPath = uri.LocalPath; configuration = ConfigurationManager.OpenExeConfiguration(dllPath); } catch { }
source share