unitycontainer / configuration

Unity.Configuration package
Apache License 2.0
13 stars 13 forks source link

Could not load file or assembly 'Unity.Abstractions, Version=4.1.1.0 #20

Closed TrayanZapryanov closed 5 years ago

TrayanZapryanov commented 5 years ago

I have a dll 'A' which is using Unity(5.10.3) + Unity.Configuration(5.10.0). It has a method which is using following code to load dynamically in container:

var unitySection = (UnityConfigurationSection)configuration.GetSection("Unity");
if (unitySection != null)
    container.LoadConfiguration(unitySection, FullTextContainerName);

Another dll 'B' using only Unity(5.10.3) - again exposing registration method to container. And a Unit test where I reference both and call their registrations methods. Once I try to execute this test I receive following exception: System.IO.FileLoadException: Could not load file or assembly 'Unity.Abstractions, Version=4.1.1.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

It can be mitigated only if I add to app.config following section: `

`

Is there any other way to do it, or I should go to all application and adapt their configs ?

ENikS commented 5 years ago

At the moment it is the only solution. I will try to fix it in the feature.