How do i deploy Microsoft SQL Server Compact 4.0?
SQL Server Compact Edition (currently at version 4.0) is:
a free, embedded database th
i've created the solution.
SQL Server Compact Edition is comprised of 7 dlls:
sqlceme40.dll The undocumented, native, flat API library (The .net System.Data.SqlServerCe.dll assembly is a wrapper around this dll)sqlceca40.dll A COM dll that implements Engine, Replication, Error and a few other COM objectssqlceoledb40.dll A COM dll that implements an OLEdb provider for SSCE (allowing the use of ADO)sqlcese40.dll unknownsqlceqp40.dll unknownsqlcecompact40.dll unknownsqlceer40en.dll unknownThe problem with trying to simply ship these dlls is that two of them are COM objects. COM object dll's need to be registered, e.g.:
>regsvr32 sqlceca40.dll
>regsvr32 sqlceoledb40.dll
The problem is that registering a COM object requires administrative privileges (using a global solution to solve a local problem). This means that your users would
Fortunately, starting in 2001 with Windows XP, Microsoft solved this COMmon problem: Registration-Free COM.
First, you will declare that your application has a "dependancy" on SQL Server Compact Edition 4.0. You do this by authoring an assembly manifest:
Hyperion Pro
true
You can place this file beside your executable (as Hyperion.exe.manifest), or you can build it into your application as an RT_MANIFEST resource.
Notice that we have a dependancy against as assembly called Microsoft.SQLSERVER.CE.4.0. We create this assembly first by creating a directory called:
Microsoft.SQLSERVER.CE.4.0
When you deploy your application, you will place all 7 dll's that comprise this "assembly" into this Microsoft.SQLSERVER.CE.4.0 subfolder, along with a special .manifest file:
C:\
|---Users
|---Ian
|---AppData
|---Local
|---Hyperion Pro
| Hyperion.exe
| Hyperion.exe.manifest
|----Microsoft.SQLSERVER.CE.4.0
sqlceme40.dll
sqlceca40.dll
sqlceoledb40.dll
sqlcese40.dll
sqlceqp40.dll
sqlcecompact40.dll
sqlceer40en.dll
Microsoft.SQLSERVER.CE.4.0.manifest
In other words, the application folder contains your application, and the Microsoft.SQLSERVER.CE.4.0 folder:
Directory of C:\Users\Ian\AppData\Local\Hyperion Pro
05/29/2012 09:23 AM 1,899,008 Hyperion.exe
05/28/2012 01:46 PM 1,587 Hyperion.exe.manifest
05/29/2012 09:27 AM Microsoft.SQLSERVER.CE.4.0
2 File(s) 1,900,675 bytes
1 Dir(s) 20,851,503,104 bytes free
The next part of your task is to define the Microsoft.SQLSERVER.CE.4.0.manifest file. Registration-free COM allows a manifest file to declare all the COM objects and their clsid's. This took a lot of reverse engineering. But the assembly manifest for SQL Server Compact Edition 4.0 is:
Microsoft.SQLSERVER.CE.4.0.manifest:
The a final gotcha is that, in the same way we have a dependancy on an assembly called Microsoft.SQLSERVER.CE.4.0, SQL Server Compact Edition 4.0 in turn has a dependancy on an assembly called Microsoft.VC90.CRT. Fortunately your install of SQLCE ships with a copy of this assembly:
|----Microsoft.VC90.CRT
| Microsoft.VC90.CRT.manifest
| msvcr90.dll
This means the final directory structure is:
C:\
|---Users
|---Ian
|---AppData
|---Local
|---Hyperion Pro
| Hyperion.exe
| Hyperion.exe.manifest
|----Microsoft.SQLSERVER.CE.4.0
| Microsoft.SQLSERVER.CE.4.0.manifest
| sqlceme40.dll
| sqlceca40.dll
| sqlceoledb40.dll
| sqlcese40.dll
| sqlceqp40.dll
| sqlcecompact40.dll
| sqlceer40en.dll
|---Microsoft.VC90.CRT
| Microsoft.VC90.CRT.manifest
| msvcr90.dll