C
C#2y ago
Murphy

❔ NuGet dependency Hell

I'm getting a bunch of System.IO.FileLoadException but resolving I can't resolve it. The FusionLog is saying 'Microsoft.EntityFrameworkCore, Version=3.1.32.0' is trying to load 'Microsoft.Extensions.Logging.Abstractions, Version=3.1.32.0'. Makes sense; so I figure I just have the wrong version referenced. Nuget had 3.1.0, so I upgrade to 3.1.32 but now 'Microsoft.Extensions.Logging, Version=3.1.32.0' is trying to load 'Microsoft.Extensions.Logging.Abstractions, Version=3.1.0.0' WTF? How, why would it be trying to load that older version? Can I reference both versions or do a binding redirect or something for a specific calling assembly? I have no idea what to do here.
9 Replies
reflectronic
reflectronic2y ago
are you using packages.config also, is this an ASP.NET application
Murphy
MurphyOP2y ago
no, .net 4.7.2, I added <dependentAssembly> <assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" /> <bindingRedirect oldVersion="3.1.0.0" newVersion="3.1.32.0" /> </dependentAssembly> to my app.config and It looked like it it's working now. I've just got a bunch of other similar loading errors I'm slogging through now. there's a bunch of ef dependencies that are like 5.0.0.0 & 7.0.0.0 after I updated from ef 3.1.30 to 3.1.32.
Angius
Angius2y ago
Uh, you're trying to use EF Core with the legacy .NET Framework...?
Murphy
MurphyOP2y ago
lol yea this solutions a total mess. legacy app mishmash with a bunch of precariously configured dependencies it's awful. I touch one thing it all comes down. but you can absolutely use ef core 3.1 with .net framework - it's supported
reflectronic
reflectronic2y ago
if this isn't ASP.NET 4.x, then you should migrate to PackageReference please don't add binding redirects yourself it is much better if you let MSBuild auto-generate them
reflectronic
reflectronic2y ago
Migrating from packages.config to PackageReference formats
Details on how to migrate a project from the packages.config management format to PackageReference as supported by NuGet 4.0+ and VS2017 and .NET Core 2.0
reflectronic
reflectronic2y ago
this is assuming you are using packages.config (i.e. you have a "packages.config" file in your repo)
reflectronic
reflectronic2y ago
Enable or disable autogenerated binding redirects - .NET Framework
Read how to enable or disable automatic binding redirection. This feature affects desktop apps and web apps targeting .NET Framework 4.5.1 or later.
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?