❔ System.IO.FileLoadException for Microsoft.SqlServer.Types

I am working on an old project (.net 4.8) and updating the dependencies. One of these is Microsoft.SqlServer.Types.dll. The original version was 10.50.2500.0. I removed this and VS suggested a nuget package, so I added that to the project which gives me version 16.0.1000.6. However, I get the following error when running the application now: System.IO.FileLoadException: 'Could not load file or assembly 'Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)' This occurs when I call the Fill(DataTable dataTable function of DbDataAdapter. I assume the issue will pop up in other places using data adapters. I checked the .csproj file and .config file and don't see any references to the 10.0.0.0 version, so why is it still trying to load that version? How can I fix this?
2 Replies
reflectronic
reflectronic17mo ago
can you show the stack trace it doesn't have to be the full thing, just the stuff right before the exception the solution is probably going to be adding a binding redirect /enabling auto-generate binding redirects
Accord
Accord17mo 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. 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.
Want results from more Discord servers?
Add your server