External DLL

  • Thread starter Thread starter Matora Nickolay
  • Start date Start date
M

Matora Nickolay

Hello. My program has to use third party components located in several
external libraries.
Those components, also as my program, are usually been changed.

The problem is to make my program use newest versions of external dlls, when
they were during my program compilation.

As far as I know, there are only 2 methods of using components storied in
external dlls:
1. Just setting reference to those libraries. But it does not solve the
problem because newest Assembly.FullName is not the same.
2. Creating a library which implements base Interfaces. So external
components just inherits those interfaces. It also doesn't solve the problem
because sometimes I have to change the base library (changes from
Debug/Release build versions, including new Interfaces and so on). Earlier
compiled external dlls does not recognize new base library (see item 1).

I rally don't want to write intermediate class like this one:
public class IntermediateClass1 {
object srcClassObject;
public int Method1(){
return srcClassObject.GetType().InvokeMember("Method1",
BindingFlags.Public | BindingFlags.InvokeMethod, null, srcClassObject, new
object [] {});
}
}

I know, the library version protection was made to solve the "Dll hell"
problem, but didn't is create a new one?
 
Hi, Nickolay.
..Net let you redirect the built application references to assemblies with
versions that are different from the versions that were used when the
application was built.

Inspect this chapter in the ".NET Framework Developer's Guide": Redirecting
Assembly Versions.
It can help you resolve your problem.
This link to MSDN Library July 2003:
ms-help://MS.MSDNQTR.2003JUL.1033/cpguide/html/cpconassemblyversionredirecti
on.htm
 
Hi.
Thank you for this articles, but I've found more useable way by using
Assembly.LoadWithPartialName() method and AppDomain.AssemblyResolve event.
 
Back
Top