Installing a Development Environment

You can develop applications that use SQL Server Compact 4.0 by using the Microsoft Visual Studio 2010 SP1 development environment. Visual Studio is the easiest way to develop and deploy an application that uses SQL Server Compact 4.0.

In Visual Studio, you can create a managed application by using Visual C# or Visual Basic. You can also create a native application for desktop computers and devices by using Visual C++ option (previously known as Microsoft eMbedded Visual C++ 4.0). Visual C++ is supported in Visual Studio 2010 Service Pack 1.

Note

  • Visual Studio 2010 SP1 supports developing and deploying applications for both SQL Server Compact 3.5 SP2 and SQL Server Compact 4.0.

  • The following designers in the Windows desktop (Visual Basic or Visual C#) project system do not work with SQL Server Compact 4.0:

    • The Data Source Configuration Wizard that is used to configure datasets.

    • The Configure Data Configuration wizard that is used to setup the syncing of data and schema with SQL Server using Sync Framework.

    • The Entity Data Model wizard that is used to generate entities from a SQL Server Compact database.

  • Microsoft eMbedded Visual Basic is not supported by SQL Server Compact 4.0.

Visual Studio File Locations and Descriptions

The following table lists the SQL Server Compact files, by location, that are installed on the development computer when you use Visual Studio 2010 Service Pack 1. By default, these files and folders are created in:

  • %ProgramFiles%\Microsoft SQL Server Compact Edition\v4.0\ for SQL Server Compact 4.0. The below setup corresponds to 32-bit operating system.

Location

Contents

%ProgramFiles%\Microsoft SQL Server Compact Edition\v4.0

SQL Server Compact 4.0 DLLs for desktop computers: sqlcecompact40.dll, sqlceca40.dll, sqlceme40.dll, sqlceoledb40.dll, sqlceqp40.dll, and sqlcese40.dll. The error descriptions DLL, sqlceer40<lang>.dll, is also installed in the folder. The error DLL for the different languages contains a two-letter suffix that indicates the language: EN, FR, and so on. The folder also contains Read Me, Licensing Terms, and Redist_<lang>.txt. The folder also contains the Managed Provider for SQL Server Compact 4.0 Entity Framework: System.Data.SqlServerCe.Entity.dll. This is the version installed in the Global Assembly Cache (GAC). Use this version of the entity framework provider when building desktop applications for which SQL Server Compact is centrally deployed; or when building device applications. Starting with SQL Server Compact 4.0, for desktop applications that privately deploy SQL Server Compact use the version of the provider in %ProgramFiles%\Microsoft SQL Server Compact Edition\v4.0\Private.

(i)%ProgramFiles%\Microsoft SQL Server Compact Edition\v4.0\Desktop

&

(ii) %ProgramFiles%\Microsoft SQL Server Compact Edition\v4.0\Desktop\System.Data.SqlServerCe.Entity

(i) Managed Provider for SQL Server Compact 4.0 for Desktop: System.Data.SqlServerCe.dll. Starting with SQL Server Compact 4.0, this folder contains the version of the managed provider to use when building desktop applications that use central deployment of SQL Server Compact. This is the version installed in the GAC. For the desktop applications that privately deploy SQL Server Compact use the version of the provider in %ProgramFiles%\Microsoft SQL Server Compact Edition\v4.0\Private.

&

(ii) Managed provider for SQL Server Compact 4.0 Entity Framework: System.Data.SqlServerCe.Entity.dll.

%ProgramFiles%\Microsoft SQL Server Compact Edition\v4.0\Private

Managed Provider for SQL Server Compact 4.0 for Desktop, System.Data.SqlServerCe.dll; and Managed Provider for SQL Server Compact 4.0 Entity Framework, System.Data.SqlServerCe.Entity.dll. This folder is introduced with SQL Server Compact 4.0. It contains the version of these providers to use when building desktop applications that use private deployment of SQL Server Compact.

(i) %ProgramFiles%\Microsoft SQL Server Compact Edition\v4.0\Desktop\<lang>

&

(ii) %ProgramFiles%\Microsoft SQL Server Compact Edition\v4.0\Desktop\System.Data.SqlServerCe.Entity\<lang>

&

(iii) %Program Files%\Microsoft SQL Server Compact Edition\v4.0\Private\<lang>

(i) Localized resources for the managed provider: System.Data.SqlServerCe.resources.dll

&

(ii) Localized resources for SQL Server Compact 4.0 Entity Framework: System.Data.SqlServerCe.Entity.resources.dll

&

(iii) In case of Private deployment, this folder is introduced with SQL Server Compact 4.0. It contains localized resources to use when building desktop applications, that use private deployment of SQL Server Compact:System.Data.SqlServerCe.Entity.resources.dll, System.Data.SqlServerCe.resources.dll

%ProgramFiles%\Microsoft SQL Server Compact Edition\v4.0\Include

SQL Server Compact 4.0 native header files (sqlce_sync.h, sqlce_err.h, and sqlce_oledb.h).

%ProgramFiles%\ Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\SQL Server Compact Edition 4.0

Series of folders that contain the SQL Server Compact 4.0 files for deploying SQL Server Compact 4.0 on desktop computers by using the ClickOnce feature of Visual Studio.

%ProgramFiles%\Microsoft SQL Server Compact Edition\v4.0\Samples

Contains the sample database, Northwind.sdf. It also contains the NorthwindOLEDB and the IBuySpy sample that is installed by the SQL Server Compact 4.0 Samples MSI.

The following table lists the location of the SQL Server Compact 4.0 binaries that are needed for privately deploying SQL Server Compact within the application folder.

Note

The folders and the binaries listed below are also installed in the %ProgramFiles (x86)%\Microsoft SQL Server Compact Edition\v4.0 folder when SQL Server Compact 4.0 is installed on a 64-bit machine.

Location

Contents

(i) %ProgramFiles%\Microsoft SQL Server Compact Edition\v4.0\Private\x86

&

(ii) %ProgramFiles%\Microsoft SQL Server Compact Edition\v4.0\Private\x86\Microsoft.VC90.CRT

All the native binaries below are specific to the X86 installation and 32-bit platform.

(i) The files in this directory are: sqlceca40.dll, sqlcecompact40.dll, sqlceer40EN.dll, sqlceme40.dll, sqlceqp40.dll, sqlcese40.dll.

&

(ii) The CRT local deployment binaries are installed further one level down. The files in this directory are: Microsoft.VC90.CRT.manifest, msvcr90.dll, Readme_ENU.txt.

(i) %ProgramFiles%\Microsoft SQL Server Compact Edition\v4.0\Private\amd64

&

(ii) %ProgramFiles%\Microsoft SQL Server Compact Edition\v4.0\Private\amd64\Microsoft.VC90.CRT

All the native binaries below are specific to the amd64 installation and the 64-bit platform.

(i) The files in this directory are: sqlceca40.dll, sqlcecompact40.dll, sqlceer40EN.dll, sqlceme40.dll, sqlceqp40.dll, sqlcese40.dll.

&

(ii) The CRT local deployment binaries are installed further one level down. The files in this directory are: Microsoft.VC90.CRT.manifest, msvcr90.dll, Readme_ENU.txt.

For information about 64-bit components, see Managing 64-bit Database Applications.

ClickOnce Deployment

ClickOnce is a software installation technology that is supported by SQL Server Compact 4.0 for deploying managed applications on desktop computers. ClickOnce simplifies deploying a Windows-based application to the desktop Computers by provisioning the application on a Web server or a network file share. For administrators, deploying or updating an application consists of updating files on a server. You do not have to update each client individually. Visual Studio 2010 Service Pack 1 provides full support for publishing and updating applications that are deployed with ClickOnce. ClickOnce deployment is available for projects that are created by using Visual Basic and Visual C#, but not for Visual C++.

Installing SQL Server Compact 4.0 Runtime

After the installation of Visual Studio 2010 Service Pack 1, you need to install SQL Server Compact 4.0. Now the runtime installation is exe file enabled. The installation behavior of SQL Server Compact 4.0 depends upon the Operating System (OS), hence, there are two different versions of exe, for the two architectures viz. 32-bit Operating System and 64-bit Operating System.

The below table shows the installation behavior of SQL Server Compact 4.0.

SQL Server Compact 4.0

Operating System

32-bit

32-bit

Successful

64-bit

Error

The combinations which say “Error” display following errors:

  • When you try to install 64-bit SQL Server Compact application on 32-bit Operating system, the error message is:“This installation package is not supported by this processor type. Contact your product vendor”.

  • When you try to install 32-bit SQL Server Compact application on 64-bit Operating system, the error message is: “SQL Server Compact x86 installation package is not supported on x64 Operating system, please try with SQL Server Compact x64 installation package”.

In order to find out your machine architecture, see How to determine which machine architecture you have?

Command Line Options for running SQL Server Compact installer

SQL Server Compact installer provides various command line options to install and perform additional operations. You can perform following operations:

  • Installation

  • Extract

  • Display

  • Access Help

  • Logging

  • Repair

Install Options:

You can use the following install parameters

  1. </package | /i> - Installs or configures SQL Server Compact Runtime.

  2. /a - Refers to administrative install and installs the product on network.

  3. /uninstall - Uninstalls the product.

Extract Option:

  • /x[:<path>] - Extracts the msi in the path specified.

Display Options:

  1. /quiet – Quiet mode, in which there is no user interaction.

  2. /passive – Unattended mode and only the progress bar is displayed.

  3. /q[n|b|r|f] – You can use these options to set the user interface level, where:

    • n - No UI

    • b - Basic UI

    • r - Reduced UI

    • f - Full UI

If you do not set the interface level, then Full UI is set as default interface level.

Help Options:

  • /help | /? – Displays help information on the console.

Logging Options:

You can use these options to log any message, warning or access records.

  • /l[i|w|e|a|r|u|c|m|o|p|v|x|+|!|*] <LogFile>, where:

    • i - Status messages

    • w - Nonfatal warnings

    • e - All error messages

    • a - Start up of actions

    • r - Action-specific records

    • u - User requests

    • c - Initial UI parameters

    • m - Out-of-memory or fatal exit information

    • o - Out-of-disk-space messages

    • p - Terminal properties

    • v - Verbose output

    • x - Extra debugging information

    • + - Append to existing log file

    • ! - Flush each line to the log

    • - Log all information, except for v and x options

    • /log <LogFile> - Equivalent of /l* <LogFile>

Repair Options:

You can use following options to repair, in case of different possible failures.

  • /f[p|e|c|m|s|o|d|a|u|v]: Repairs the product:

    • p - Only if file is missing

    • o - If file is missing or an older version is installed (default)

    • e - If file is missing or an equal or older version is installed

    • d -If file is missing or a different version is installed

    • c - If file is missing or checksum does not match the calculated value

    • a - Forces all files to be reinstalled

    • u - All required user-specific registry entries (default)

    • m - All required computer-specific registry entries (default)

    • s - All existing shortcuts (default)

    • v - Runs from source and reaches local package

See Also

Reference

Deploying Applications (SQL Server Compact)

Concepts

Building Native Applications (SQL Server Compact)

Other Resources

Building Managed Applications (SQL Server Compact)