app.config file name isn't the same as the exe name when AppDomain.CreateDomain is called
Posted on 2005-04-27
I am using a custom form of the AppUpdater component to do updates to a smart client I am developing.
I am using the AppStart.exe practically unmodified. This exe is a bootstrap exe which launches my smartclient windows exe (written in C#) using AppDomain.CreateDomain to launch the smart client exe. The relevant code is:
string AppExePath = (path to the smartclient exe, which is in a subdirectory of the appstart.exe file);
AppDomain NewDomain = AppDomain.CreateDomain (
"New App Domain",
retValue = NewDomain.ExecuteAssembly(AppExePath,AppDomain.CurrentDomain.Evidence,cmdLineArgs);
This all works fine except for my smartclient exe doesn't look in it's own app.exe.config file when I call ConfigurationSettings.AppSettings["key"] instead it looks for a config file named after the bootstrap exe. in this case, if I copy the appstart.exe.config file into the same directory as the smartclient exe (which is in a subdirectory of appstart.exe) then it looks in there. Is there a way to either start the smartclient assembly correctly so that it looks in its own app.config file or to during runtime specify the location & name of the config file to use?