Link to home
Start Free TrialLog in
Avatar of datajive
datajiveFlag for United States of America

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.Evidence,
      Path.GetDirectoryName(AppExePath)+@"\",
      "",
      false);

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?
ASKER CERTIFIED SOLUTION
Avatar of testn
testn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial