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:
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..cab
(like sql.wce5.armv4i.CAB
) and this dbnetlib.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).
dbnetlib.dll
, since System.Data.SqlClient.dll does get deployed.
.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.)
Visual Studio generally does a good job of working out what to deploy, but it isn't fullproof. For example if the DLL is linked dynamically then it has no way of knowing that it is required and won't deploy it: it also routinely and silently fails to deploy files to the Windows directory.
I would recommend that you manually deploy the file during development. I generally prefer to do this anyway to make sure I know what has been deployed (the joy of batch files...).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With