无法加载Microsoft.SqlServer.Types 10,但是引用了版本11 [英] Could not load Microsoft.SqlServer.Types 10, but version 11 is referenced

查看:96
本文介绍了无法加载Microsoft.SqlServer.Types 10,但是引用了版本11的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个C#应用程序,其中引用了多个项目.该项目之一是引用Microsoft.SqlServer.Types(版本11),因为它使用的是SQLGeometry.当我将应用程序安装到一台空计算机上(仅Windows 7和VC ++ 2010)时,我的应用程序中出现错误,提示"

I have a C# application with multiple project referenced. One of the project is referencing Microsoft.SqlServer.Types (Version 11), because it is using SQLGeometry. When i install my application to an empty computer (Only windows 7 with VC++ 2010) i get an error in my application, that it "

无法加载文件或程序集'Microsoft.SqlServer.Types,版本= 10.0.0.0,文化=中性,PublicKeyToken = 89845dcd8080cc91'或其依赖项之一.

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

有什么想法为什么需要版本10?

Any ideas why it would require Version 10?

推荐答案

请参阅此答案.您需要请执行以下任一操作:

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

  1. Type System Version = SQL Server 2012 关键字添加到 app.config 中的连接字符串:
  1. Add the Type System Version=SQL Server 2012 keyword to your connection string in app.config:

< configuration>< connectionStrings>< add name ="YourConnectionStringName" connectionString =(连接字符串值);类型系统版本= SQL Server 2012"/></connectionStrings></configuration>

  1. app.config 中为 Microsoft.SqlServer.Types 添加 bindingRedirect :

< configuration><运行时>< 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>

这两个选项都将确保 SqlConnection 将加载 Microsoft.SqlServer.Types 程序集的版本11.0.0.0,而不是版本10.0.0.0.

Either option will ensure that SqlConnection will load version 11.0.0.0 of the Microsoft.SqlServer.Types assembly, instead of version 10.0.0.0.

这篇关于无法加载Microsoft.SqlServer.Types 10,但是引用了版本11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆