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>
inapp.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
inApplication_Start
method.SqlProviderServices.SqlServerTypesAssemblyName = "Microsoft.SqlServer.Types, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91";
Installing
Microsoft.SqlServer.Types
usingNuGet
.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 for2012, 2014, 2016
and2017
.
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 ofapp.config
. Hope this help someone else.Code: web.config
Microsoft.SqlServer.Types -Version 14.0.314.76 is the current version. try changing your version number. Second, check your .csproj file, Application also maintains its dependencies in .csproj file