Please refer to this answer. You need to do one of the following:
- Add the
Type System Version=SQL Server 2012
keyword to your connection string in app.config
:
<configuration>
<connectionStrings>
<add name="YourConnectionStringName" connectionString="(connection string values);Type System Version=SQL Server 2012" />
</connectionStrings>
</configuration>
- Add a
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>
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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…