Problems with versions with assemblies

Let's assume I have two assemblies:

MyExecutable.dll    version 1.0.0
MyClassLibrary.dll  version 1.0.0

      

Now MyExecutable.dll

currently uses classes and methods MyClassLibrary.dll

(including some algorithms). Most of these algorithms were done in progress, as I will want to refine them later if necessary. This means that I will not change interface

these classes, but the code itself will see some changes.

The question is what MyExecutable.dll

will be expected MyClassLibrary.dll 1.0.0

and I want it to use version 1.0.1 (or something like that). I don't want to recompile MyExecutable.dll

(because there could actually be more than one executable using MyClassLibrary.dll

). Is there a solution to this problem? I have heard about GAC

, but if possible, I would like to stay away from him.

thanks

+2


a source to share


2 answers


What you are looking for Assembly Binding Redirection

is a custom way to tell .NET which version assemblies to use.



+2


a source


The first solution is to redirect the assembly binding, already recommended by Oded.
This is beneficial if you have fewer .dlls and want to do something with newer versions of it.



The second option is to create a separate assembly for the interfaces and only reference the executable.
Thus, you can allow third parties to create materials against your library without providing them with the exact assembly of the library. (For example, they can't decompile it with Reflector, so it's safer that way.)
As long as the interface assembly doesn't change, you can change other things in the library pretty much however you want.

+1


a source







All Articles