app.config file name isn't the same as the exe name when AppDomain.CreateDomain is called

Posted on 2005-04-27
Last Modified: 2007-12-19
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?
Question by:datajive
    1 Comment
    LVL 18

    Accepted Solution


    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
    A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now