I have a .Net multi-appdomain application that looks like a scheduler. By default, the application domain has a timer and a list of tasks that are contained in each own assembly and run in separate application domains. Assemblies containing tasks are stored in each separate directory under the root of the application.
(root)\Library\AssemblyName\
Each assembly directory contains the assembly and its dependencies. Some of these dependencies (for example, log4net) are also contained in the root directory, since the default domain has a separate log. I want to download the assembly of the task and its dependencies from the assembly directory, if they exist there, and if I do not want to load them from the root directory of the application. Both main domains, appdomain and child, use the same library with interfaces similar to the Quartz IJob interface, so this assembly must be loaded from the same file.
The reason for this rather strange requirement is that application jobs must be able to automatically update. Thus, a specially designed class will load the task from the API, unload the application in which the task is executed, delete the task assembly with all the dependencies, and restart the application and restart the task without interfering with the work of other tasks. I tried using AppdomainSetup to set the Assembly directory in front of the root directory,
domainSetup.PrivateBinPath = @"\\Library\\AssemblyName\\"
however, my dependencies are resolved from the root directory every time.
So basically I want my dependency to be resolved from 1. Folder to build, if possible 2. Root directory
source
share