Self restarting application RRS feed

  • General discussion

  • I have a console app which acts as a loader for another console app. (both are .Net 4.0)

    The loader is running in the default AppDomain.

    When I need the other app started, the loader spins up a new thread and from there creates a new AppDomain and calls ExecuteAssemblyByName()

    This works neat, but when something in the other app is happening, I want the AppDomain to be unloaded and the AppDomain/Assembly to restart.
    (In reality. the AppDomain is setup with shadow copy and there is probably a newer version of the assembly which shall be started)

    I have achieved most of this except the part where the app must talk to the loader to unload and reload the AppDomain.
    How to do this communication as simple as possible considering the loader thread must be used for this (I think)?

    Sunday, July 15, 2018 2:35 PM

All replies

  • Found out, very easy by a common object (inheriting from MarshalByRefObject) implementing standard eventing, this object "injected" into sub AppDomain by AppDomain.SetData();
    Thursday, July 19, 2018 9:09 PM