datajive
asked on
app.config file name isn't the same as the exe name when AppDomain.CreateDomain is called
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",
AppDomain.CurrentDomain.Ev idence,
Path.GetDirectoryName(AppE xePath)+@" \",
"",
false);
retValue = NewDomain.ExecuteAssembly( AppExePath ,AppDomain .CurrentDo main.Evide nce,cmdLin eArgs);
This all works fine except for my smartclient exe doesn't look in it's own app.exe.config file when I call ConfigurationSettings.AppS ettings["k ey"] 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?
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",
AppDomain.CurrentDomain.Ev
Path.GetDirectoryName(AppE
"",
false);
retValue = NewDomain.ExecuteAssembly(
This all works fine except for my smartclient exe doesn't look in it's own app.exe.config file when I call ConfigurationSettings.AppS
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.