Reputation: 31
I have an application that loads two assembly dlls. First dll is a common dll and the second dll has reference to another version of the first dll. All assemblies are unsigned.
App.exe --> dll1_v1.dll, dll2.dll
dll2.dll --> dll1_v2.dll
Both dll1_v1.dll and dll1_v2.dll have same types but different implementations.
If I have both dll1_v1.dll and dll1_v2.dll in the codebase path of the exe, then both get loaded and all object instances in app.exe point to dll1_v1.dll and in dll2 point to dll1_v2.dll.
If I need to point dll1_v2 to dll1_v1, is it correct to remove dll1_v2.dll from the codebase and add AssemblyResolve event handler so I can return the Assembly for dll1_v1.dll in place of dll1_v1.dll?
Upvotes: 3
Views: 611
Reputation: 35767
You can reference different version of same class by extern alias keyword. Following blog post explain it nicely.
Upvotes: 1