简体   繁体   中英

SQL Server Compact Edition and ADO.NET Provider File Version Mismatch Exception

I have a windows forms project built on visual studio 2013 in which I have a .sdf file. I wanted to deploy/publish my database with my application so I followed Alizee Hayek's answer on: https://social.msdn.microsoft.com/Forums/windows/en-US/5042b5ba-26ca-4b36-b727-9ee59410925b/deploying-sql-server-ce-with-a-clickonce-application?forum=winformssetup

I did everything he wrote except for adding DataGridView in my form.

When i published my app using ClickOnce and installed it on another laptop, I got this error:

System.Data.SqlServerCe.SqCeException (0x8000405): Possible file version     
mismatch detected between ADO.NET Provider and native binaries of SQL Server 
Compact which could result in an incorrect functionality. This could be due to 
the presence of multiple instances of SQL Server Compact of different versions 
or due to wrong binaries with same name as SQL Server Compact binaries. Please 
install SQL Server Compact binaries of Matching version.

I am not being able to understand what is wrong

Your version of System.DataSqlServerCe.dll does not match the version of the unmanaged dll files on the machine. Private deployment sounds like a solution to your problem. Do you use Entity Framework or Ado.net/Linq to sql? The best approach depends on this.

I fixed this error by running the command found on this page: https://www.nuget.org/packages/EntityFramework.SqlServerCompact/4.1.8482.2

This changed the version from 6.1.0 to 4.1.xxxx and solved the issue.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM