0

I get the following error:

'Could not load file or assembly 'Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies '

And I have a reference to

Microsoft.SqlServer.Types version 15

but have checked all the files in the project, deleted the Debug and Release directories and rebuilt both. And there is no reference to Version 10 in any file and all the sqlserver DLL's referenced are copying to the Debug directory.

I can't understand where and why a reference to version 10 would exist. Any advice wold be welcome.

jmcilhinney
  • 50,448
  • 5
  • 26
  • 46
David T
  • 1
  • 1
  • Is this happening when debugging or when running the Release build on a different machine? What SQL Server references did you add and how? How exactly are you using them? – jmcilhinney Aug 15 '20 at 03:45
  • It occurs either during a debug session or when using the Release executable. The SQL references were added manually as I needed them. At one stage on a different computer I probably did have version 10, but on the current computer I have changed them to version 15 because that is all that is available on this machine. – David T Aug 15 '20 at 05:23
  • If you do a *Find In Files* for "Version=10.0.0.0" does anything turn up? – jmcilhinney Aug 15 '20 at 05:59
  • No, _the following specified text was not found_ – David T Aug 15 '20 at 06:30
  • If you build the project and then search in the files in the build directory for "Version=10.0.0.0" (you could write your own program to do that rather than hope Windows search will find it), which files does it appear in? – Andrew Morton Aug 15 '20 at 08:34
  • Indeed, Andrew - I wouldn't use windows file search to find a string, because it only knows how to look in certain types of file – Caius Jard Aug 15 '20 at 08:39
  • Do you have any binding redirects in any of your config files? – Caius Jard Aug 15 '20 at 08:39
  • @DavidT There are a few tools to track down the problem mentioned in [Could not load file or assembly or one of its dependencies](https://stackoverflow.com/questions/4469929/could-not-load-file-or-assembly-or-one-of-its-dependencies). – Andrew Morton Aug 15 '20 at 08:41
  • Hi Andrew,It doesn't find any reference to Version 10 after a Rebuild All. Butafter running the built release version it still returns _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) File name: 'Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'_ – David T Aug 15 '20 at 08:43
  • Now your binding redirect is wrong, probably.. i.e. it's finding v15 and your app is demanding v10. Do a "find in files" using a capable text editor in the bin directory for the word "redirect". – Caius Jard Aug 15 '20 at 09:38
  • But why wold the app want 10 when the database and the version of sql server is much higher? I think this is probably the source of my confusion, the relationship between database versions, sql server versions and the SDK assemblies. – David T Aug 15 '20 at 09:41
  • The version of a DLL is nothing to do with the version of SQL Server.. The version of anything is pretty much nothing to do with the version of anything else. I can connect my Excel 2019 to my SQLS2008 ! – Caius Jard Aug 15 '20 at 18:26
  • "The located assembly's manifest definition does not match"-everyone hits this sooner or later. You reference some nuget package X and another Y. X also references Y, but a different version.By some decision mechanism the Y v1.0.1 that your app uses and the v1.0.0 that X uses end up in a conflict that is resolved such that the 1.0.0 wins, your app wants 1.0.1 but finds 1.0.0..We can mostly solve these things by using binding redirects. We install 1.0.2 of Y, and put a "redirect any attempt to load 1.0.0 - 1.0.2, to v1.0.2" in the config.Probably 1.0.2 will work in place of 1.0.1 for X's needs – Caius Jard Aug 15 '20 at 18:33
  • That did it! did a bit of research on binding redirects and set it up in the app.config and I now have a working program again. Thanks Caius Jard. – David T Aug 16 '20 at 09:31

0 Answers0