I create primarily programs that are addins to a different parent software; other people and companies make addins for the parent software as well. This becomes a problem when two companies use different versions of the same third party library, they are loaded into the same AppDomain because the parent software is the one loading them.
Lets use Newtonssoft.Json.dll as it's pretty common. If I use 12.0.1 and some other company uses 11.0.2 then there is a conflict. If their addin is loaded first then I get version 11.0.2 as it's already loaded, which can cause my app to collapse. If mine is loaded first, it's vice versa; theirs will get 12.0.1 and likely collapse. Both work without issue on their own, but one or the other creates a fatal error if they are both installed.
Is there a way to encapsulate these so that they load independently? I recently discovered Costura.Fody and thought maybe that was the answer. However, it still loads the assembly with the same name even though it's loading from embedded instead of disk. I also noticed that internally it changes the name to 'Costura.Newtonsoft.Json' but when I tried it in debug, it was still loaded as 'Newtonsoft.Json'. I'm wondering if there is any way to somehow change the name or identity that .NET loads the dependencies as so that it sees it as different and can be isolated from other addins in the same app domain. Something like making it load as ABC.Newtonsoft.Json.dll and then the other company could load as DEF.Newtonsoft.Json.dll or something.
Anyway, looking for some good way to deal with this on a permanent basis... Any help is greatly appreciated.