Reputation: 6295
I have an assembly that I built which will be dynamically loaded into my application. However, I would like to make a copy of this assembly and load it as well, but it turns out that this results in unwanted behavior:
If an assembly with the same identity is already loaded, LoadFrom returns the loaded assembly even if a different path was specified.
The link above to my original question explains that although I have 2 of the same assemblies, they both read from their own xml settings file. So, is it possible to programmatically 'rebuild' an existing assembly so that it's identity changes, but still has the same structure?
Any alternatives to the same result are really appreciated too.
Upvotes: 2
Views: 699
Reputation: 57966
Maybe the question here isn't how to rebuild, but how to reload it. You'll need to create a different AppDomain and load the new assembly into it.
Take a look here: Using AppDomain to Load and Unload Dynamic Assemblies
Upvotes: 1
Reputation: 131
You can try to copy and rename it. But you will still have the same namespaces.
Isolating assemblies can be achieved with Application Domains.
https://msdn.microsoft.com/en-us/library/ms173138%28v=vs.90%29.aspx
The drawback of this is that the communication is complicated.
Upvotes: 2