Recently I have started using SSMS 2017 (v17.5). In my MVC application, I am getting Could not load file or assembly 'Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies.
error. Only thing changed in my application is Microsoft.SqlServer.Types
version which is 14.0.0.0
now. Previously, it was 12.0.0.0
.
Following are different options I have tried so far based on my research (this includes another stackoverflow
articles + google) but I am getting same error.
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>
Adding following line in Global.asax.cs
in Application_Start
method.
SqlProviderServices.SqlServerTypesAssemblyName = "Microsoft.SqlServer.Types, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91";
Installing Microsoft.SqlServer.Types
using NuGet
.
PM> Install-Package Microsoft.SqlServer.Types
Searched for 10.0.0.0
referance in entire project but didn't find any referance.
I do have Microsoft System CLR Types for SQL Server
installed for 2012, 2014, 2016
and 2017
.
What am I missing here?
After spending almost a day, I was able to fix this issue. From my question above, option-1 worked for me. Only tweak was to add that in web.config
instead of app.config
. Hope this help someone else.
Code: 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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With