dimanche 26 avril 2015

'Assembly uses xxx which has a higher version' vs 'Could not load file or assembly'


I have a .NET application that has a number of references. Many of those references have their own dependencies.

In other words, there is an application A that depends on application B, which, in turns, references assembly C. There is also a dependency on D that relies on E.

So, if I want to use a different version of C. I just reference that different version in my .csproj of A. I obviously get a runtime exception of Could not load file or assembly... The located assembly's manifest definition does not match the assembly reference. I easily solve that problem by using BindingRedirect.

However, if I'm trying to use a different version of E, I instead get a compilation error saying that 'Assembly uses xxx which has a higher version of yyy. And that compilation error cannot be solved by the runtime directive bindingRedirect.

Both 'B' and 'D' are strongly named assemblies. And there are no noticable differences between the way they are built.

Why in one case I receive a runtime exception (solvable by bindingRedirect) and a compilation error in another?


Aucun commentaire:

Enregistrer un commentaire