I have interface A defined in A.dll version 3.0 I have B.dll which references A.dll 3.0 and implements interface A in class B.
I now have the same A.dll, identical in every way except it is version 3.1.
I try to load B.dll referencing version 3.0 of A.dll. But 3.1 is loaded in memory.
var assembly = Assembly.LoadFile(dllPath);
var types = assembly
.GetTypes();
var extensionClass = types
.First(x => typeof(T).IsAssignableFrom(x) && x.IsClass);
_logger.Debug.Log($"Creating instance for {dllPath} of type {extensionClass.FullName}");
var instance = (T)Activator.CreateInstance(extensionClass);
return instance;
But that does not work.
I get sequence contains no matching elements.
I cannot use an App.config to do an assembly redirect as the code loading B.dll is running inside a host process out of my control.
What can I do aside from keeping A.dll at the same version forever?
Aucun commentaire:
Enregistrer un commentaire