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 "
Could not load file or assembly 'Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies.
Any ideas why it would require Version 10?
Please refer to this answer. You need to do one of the following:
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>
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.
Somewhere in your solution a project (csproj file) or the web/app.config is still referencing version 10.0.0.0. Search solution wide for the string 10.0.0.0 and you will find the reference.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.