none
Using SqlClient reference required dbnetlib.dll, which requires .NET CF 2.0. How to use .NET CF 3.5 then? RRS feed

  • Question

  • I have this problem:

    My app needs to query some data on a SQL Server 8 or 9 database. For this, I've added the SqlClient reference, which apparently p/invokes a .dll called dbnetlib.dll. Obviously, that .dll was not in my Windows folder, so I've decided to add the SQL Server Managed Provider component from platform builder components list to my image. However, the problem is that selecting that .dll will also add .NET Compact Framework 2.0 as a component. And since .NET Compact Framework 3.5 was originally added as a component to my image, now when I try to start the app, it crashes right from the beginning (which was expected).

    I would like to know how to handle the dbnetlib.dll problem, so that I keep .NET Compract Framework 3.5 component in the image components list.

    Thanks in advance!

    Tuesday, November 15, 2011 10:40 AM

All replies

  • Windows CE version? 5? I created new catalog files for using the SQL Server Client with .NET CF 3.5, added them to my catalog and included them in my OS (change the dependencies). However, what I decided was that the effort to build the SQL Server Client into the operating system was too high. Instead, I installed it on the persistent storage (or allowed my customer to do that). This allowed client updates to be handled more-smoothly and also allowed customers who didn't need the client to save space.

    Paul T.

    Tuesday, November 15, 2011 4:55 PM
  • I'm affraid I wasn't clear enough, so here are some more details:

    The image I'm working on is Windows CE 6.0. The problem relates to the fact that my .NET Compact Framework 3.5 app needs to query some data from a SQL Server 8. In order to have instances of the classes from the System.Data.SqlClient namespace, I need to add this component (apparently) to my OS image: SYSGEN_SQLCOMPACT_SQLMP. Otherwise, my app will crash with an error that says that dbnetlib.dll is missing.

    If I select SYSGEN_SQLCOMPACT_SQLMP in the OS's components, I automatically get .NET Compact Framework 2.0 added, because this SYSGEN_SQLCOMPACT_SQLMP component apparently depends on it. Obviously, the moment both .NET CF 2.0 and .NET CF 3.5 components are in the image, the application crashes.

    Please advise!


    • Edited by Mang AlexMVP Tuesday, November 15, 2011 5:09 PM grammar
    Tuesday, November 15, 2011 5:08 PM
  • Hi,

    I remember that we had the same problems integrating SQL support to our image.

    In the end I modified (after creating backup copies and including the file in TFS)

    sqlcompact.bat  - changing the SYSGEN_DOTNET_XXX variables from .NET 2.0 to .NET 3.5

    netcfv2.bat - removing the dependencies for .NET V2 for SQL managed providers, i.e. I commented out the following lines

        if "%SYSGEN_SQLCOMPACT_MP%"=="1" set SYSGEN_DOTNETV2=1
        if "%SYSGEN_SQLCOMPACT_SQLMP%"=="1" set SYSGEN_DOTNETV2=1

    These changes removed .NET CF 2.0  from our image leaving only 3.5 and SQL works like a charm.

    HTH,

    Bjoern

    Wednesday, November 16, 2011 9:35 AM
  • Uhm, I miss finding any SYSGEN_DOTNET_... variable in the sqlcompct.bat file (which is located here: C:\WINCE600\PUBLIC\CEBASE\OAK\MISC).

    Is it ok if I leave that section of your suggestion out?


    UPDATE:

    Building as we speak (with just the second file - netcfv2.bat - modified)

    • Edited by Mang AlexMVP Wednesday, November 16, 2011 1:05 PM
    Wednesday, November 16, 2011 1:02 PM
  • Hi,

     

    Sorry if I was not precise enough.

    I', afraid that you will also have to modify the sqlcompact.bat since it includes .NET CF 2.0 as a default when the sysgen variables for the managed providers are set.

    Here's a part of the sqlcompact.bat that I have modified to use .NET CF 3.5.

     

    if /i not "%1"=="pass1" goto :Not_Pass1
        if not "%SYSGEN_SQLCOMPACT_MP%"=="1" goto noSQLCOMPACTMP
    	set SQLCOMPACT_MODULES=%SQLCOMPACT_MODULES% sqlcompactmp
    	set SYSGEN_SQLCOMPACT=1
    	if not "%SYSGEN_DOTNETV35_HEADLESS%"=="1" set SYSGEN_DOTNETV35=1
        :noSQLCOMPACTMP
        if not "%SYSGEN_SQLCOMPACT_SQLMP%"=="1" goto noSQLCOMPACTSQLMP
    	set SQLCOMPACT_MODULES=%SQLCOMPACT_MODULES% sqlcompactsqlmp
    	set SYSGEN_SQL2000_DP=
    	if not "%SYSGEN_DOTNETV35_HEADLESS%"=="1" set SYSGEN_DOTNETV35=1
        :noSQLCOMPACTSQLMP
        if not "%SYSGEN_SQLCOMPACT%"=="1" goto noSQLCOMPACT
            set SQLCOMPACT_MODULES=%SQLCOMPACT_MODULES% sqlcompact
    	set __SYSGEN_FILESYS=1
            set __SYSGEN_NEED_LOCUSA=1
            set SYSGEN_FMTMSG=1
            set SYSGEN_MINGWES=1
            set SYSGEN_CORESTRA=1
            set SYSGEN_OLE_GUIDS=1
            set __SYSGEN_NEED_MINICOM=1
            set __SYSGEN_OLEAUT32_FULL=1
            set SYSGEN_CPP_EH_AND_RTTI=1
        :noSQLCOMPACT
        
        goto :EOF
    :Not_Pass1
    

     HTH,

    Bjoern

     

    Wednesday, November 16, 2011 2:36 PM