How to change Reference dll with running application?

0

I have a project where I need to use a reference with different versions in a single execution, for example:

Switch the System.Drawing version 2.0.0 reference to System.Drawing version 1.0.0

Is it possible to do this?

    
asked by anonymous 16.08.2018 / 18:47

1 answer

0

It is possible through a dynamic invocation of the assembly:

// caminho da DLL antiga
var assembly = Assembly.LoadFile("caminho");

// tipo da classe desejada
dynamic instancia = assembly.CreateInstance("tipo");

// chamar o método que está procurando ou fazer o que precisar com a variável
instancia.MetodoDesejado();
    
17.08.2018 / 15:59