During developing a sort of plugin interface for the .NET Micro Framework I
get the following problem:
To dynamically loading an assembly inside a new AppDomain I first need to
Load the Assembly in the default Appdomain with the next statement:
Assembly.Load(byte[] rawAssembly).
After I loaded the assembly in the default Appdomain it's possible to load
the assembly in a new Appdomain and create a instance of a type within this
new Appdomain. This instance runs perfectly.
Now when I want to load an updated version of a assembly who is already
loaded in the default Appdomain I get the following problem.
Because the old assembly is still loaded in the default Appdomain this
assembly is returned by executing the command Assembly.Load(newAssembly).
My new/updated assembly isn't loaded in the default Appdomain so I cannot
create a new Appdomain and loading an instance of my new assembly in it.
Is there something that I can do to solve this big problem?
Is there some sort of way to load an assembly within a AppDomain without
first loading the assembly in the default Appdomain (Assembly.Load)?
I think Appdomain.Unload() isn't usefull this way because the assemblies
loaded in the default Appdomain aren't being unloaded so loading an updated
assembly with the same name, results in executing the old assembly because
this one is still in memory and will be loaded while executing
AppDomain.Load(assembly name).
Can someone give me some hints how to prevent this behaviour?
Thanks!