最近我开始使用 SSMS 2017 (v17.5)。在我的 MVC 应用程序中,我收到以下错误。
Could not load file or assembly 'Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies.
我的应用程序中唯一改变的是Microsoft.SqlServer.Types
版本是14.0.0.0
现在。此前,它是12.0.0.0
.
以下是我迄今为止根据我的研究尝试过的不同选项(这包括另一个stackoverflow
文章+谷歌)但我遇到了同样的错误。
- Add
<dependentAssembly>
in app.config
<dependentAssembly>
<assemblyIdentity name="Microsoft.SqlServer.Types" publicKeyToken="89845dcd8080cc91" culture="neutral" />
<bindingRedirect oldVersion="10.0.0.0-11.0.0.0" newVersion="14.0.0.0" />
</dependentAssembly>
- 添加以下行
Global.asax.cs
in Application_Start
method.
SqlProviderServices.SqlServerTypesAssemblyName = "Microsoft.SqlServer.Types, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91";
- 安装中
Microsoft.SqlServer.Types
using NuGet
.
PM> Install-Package Microsoft.SqlServer.Types
-
搜索10.0.0.0
在整个项目中参考,但没有找到任何参考。
-
我有Microsoft System CLR Types for SQL Server
安装用于2012, 2014, 2016
and 2017
.
我在这里缺少什么?
经过将近一天的时间,我终于解决了这个问题。从我上面的问题来看,选项 1 对我有用。唯一的调整是将其添加到web.config
代替app.config
。希望这对其他人有帮助。
代码:web.config
<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-14.0.0.0" newVersion="14.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)