Load .NET Core library to .NET 4.5 Framework, Could not load file or assembly Microsoft.Extensions.DependencyInjection.Abstractions

0

We have one library .NET Core 3.1 which is used in .NET core app, now we need to use add it to .NET Framework 4.7 app which is not yet migrated to .NET core. I have added <TargetFrameworks>net47;netcoreapp3.1</TargetFrameworks> to the library and be able to install it to .NET Framework 4.7 app and it installation went fine. Unfortunately, when we run app we get the error

Microsoft.Practices.ServiceLocation.ActivationException: Activation error occurred while trying to get instance of type IDbContext, key "" ---> Microsoft.Practices.Unity.ResolutionFailedException: Resolution of the dependency failed, type = "CA.Database.Interfaces.IDbContext", name = "(none)".
Exception occurred while: Calling constructor CA.Database.Context.DatabaseContext(System.String connectionString).
Exception is: FileLoadException - Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=3.1.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

It seems something wrong with bindings. Then I have added <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> to project file but that does not help.

asp.net-core-3.1
.net-4.7
asked on Stack Overflow Jun 17, 2020 by Tomas • edited Jun 17, 2020 by Tomas

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0