I'm developing a device application, using a connection with a 'regular' Sql Server 2005 (not a Compact DB). Whenever I try to open SqlConnection on Windows CE (a Datalogic Memor CE), I’m getting a MissingMethodException
: Can't find PInvoke DLL 'dbnetlib.dll'.
.
This seems to be a deployment issue. In my project I include:
C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v3.5\Devices\Client\System.Data.SqlClient.dll
The file System.Data.SqlClient.dll
does get deployed to my application directory, but there is no sign of dbnetlib.dll
.
When I Google this Exception, I mainly get these suggestions:
- This is a Microsoft bug, when Visual Studio 2005 and 2008 are installed. Resolve by (re)installing 'SQL Server Compact 3.5 Design Tools' http://support.microsoft.com/kb/945371.
- I have Visual Studio 2008 and 2010 - AFAIK 2005 was never on my system. I tried un- and re-installing the SQL Server Compact 3.5 Design Tools (\WCU\SSCE\SSCEVSTools-enu.msi)
- Edit: Since the
Devices\Client
-directory is installed by 'SQL Server Compact 3.5 for Windows Mobile' (SSCEDeviceRuntime-ENU.msi
), I downloaded and also tried un- and re-installing the base version, SP1 and SP2, but there was still no deployment-difference.
- Another suggestion is to install the SQL Client separately using a (platform-dependent)
.cab
(likesql.wce5.armv4i.CAB
) and thisdbnetlib.dll
copied from e.g.C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v3.5\Devices\Client\wce500\armv4i
to a persistent start-up directory (like\Backup\Startup
on this Datalogic).
Without trying, I think this might even be limited to including this platform-dependentdbnetlib.dll
, since System.Data.SqlClient.dll does get deployed.
But this seems more like a a work around to me, deployment should take care of this. Drawback of this work around seems:- an install is executed at each cold boot (and maybe even at a warm boot)
- adding (more) platform (and version) dependency to my project by explicitly defining the
.cab
The question is: do you know a solution for Visual Studio to deploy correctly?
Another question might be: do you have an opinion about this work around?
(BTW: the DB-connection works fine on a Datalogic Memor WM (Windows Mobile), so I guess the appropriate .NET-library is already installed on that device.)