Failed to load Microsoft.SqlServer.Types 10 files, but link to version 11

I have a C # application with several project links. One of the projects is related to Microsoft.SqlServer.Types (version 11) because it uses SQLGeometry. When I install my application on an empty computer (only Windows 7 with VC ++ 2010), I get an error message in my application that it "

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

Any ideas why this would require Version 10?

+6
source share
2 answers

Please refer to this question. You need to do one of the following:

  • Add the Type System Version=SQL Server 2012 keyword to the connection string in app.config :

<configuration> <connectionStrings> <add name="YourConnectionStringName" connectionString="(connection string values);Type System Version=SQL Server 2012" /> </connectionStrings> </configuration>

  1. Add bindingRedirect for Microsoft.SqlServer.Types in app.config :

<configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Microsoft.SqlServer.Types" publicKeyToken="89845dcd8080cc91" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration>

Any option ensures that SqlConnection downloads version 11.0.0.0 of the Microsoft.SqlServer.Types assembly instead of version 10.0.0.0.

+6
source

Somewhere in your solution, the project (csproj file) or web / app.config still refers to version 10.0.0.0. Find the solution for line 10.0.0.0 and you will find the link.

+2
source

Source: https://habr.com/ru/post/977961/


All Articles