Deploying Desktop Applications

Applications developed for the desktop are installed like any other Microsoft Windows application. You can deploy Windows-based applications from Visual Studio by using either of the following technologies: ClickOnce or Windows Installer. For more information about deploying applications from Visual Studio, see the Visual Studio 2010 documentation. Your application can be built to use either central or private deployment for SQL Server Compact 4.0; for more information, see Private Deployment vs. Central Deployment (SQL Server Compact). For more information about building a desktop application that uses SQL Server Compact, see Building Applications for Desktops (SQL Server Compact).

Note

If a user installs an application built with SQL Server Compact 4.0 on a 64-bit computer by using ClickOnce technology, and SQL Server Compact 4.0 was selected as an installation prerequisite by the publisher, then the 64-bit SQL Server Compact Runtime is only installed, since it installs both the WOW64 and x64 components of SQL Server Compact 4.0. Similarly, on a 32-bit machine only the 32-bit SQL Server Compact runtime is installed.

Final Application Deployment for Applications that use Central Deployment for SQL Server Compact

If you use ClickOnce technology to deploy your application, you can configure ClickOnce to centrally deploy Microsoft SQL Server Compact 4.0 to the target computer as a prerequisite when your application is installed. You can do this from the Publish tab of the Project Designer in Visual Studio. 

To Configure SQL Server Compact as a Prerequisite for ClickOnce Deployment

  1. To open the Project Designer, in Solution Explorer, double-click My Project if you are working on a Visual Basic project; or right-click the project and select Properties if you are working on a C# project.

  2. Click Prerequisites to open the Prerequisites dialog box.

  3. Select the box for SQL Server Compact 4.0 from the list of prerequisites. If your application uses either the ADO.NET data provider (System.Data.SqlServerCe.dll) or the Entity Framework data provider (System.Data.SqlServerCe.Entity.dll), .NET Framework 3.5 SP1 or a later version must be present on the target computer. If your application uses either of the data providers, make sure that the checkbox for the version of .NET Framework suitable for your application is also selected.

    Note

    The Create setup program to install prerequisite components check box must be selected to configure prerequisites.

  4. Under Specify the install location for prerequisites, select the appropriate option for your publishing scenario, and then click OK

If SQL Server Compact 4.0 is not installed as a prerequisite during deployment, you must install it on the target computer by running the SQL Server Compact installer for desktop computers (SSCERuntime_architecture-locale.exe ). Here the architecture is a placeholder for x86 or x64 and the locale is a placeholder for the language of the installation such as, ENU for English, JPN for Japanese. Installing SQL Server Compact by running the installer registers the native DLLs and puts the managed assemblies in the Global Assembly Cache (GAC).

The installer contains the following libraries:

  • SQLCESE40.DLL

  • SQLCEQP40.DLL

  • SQLCEME40.DLL

  • SQLCEOLEDB40.DLL (OLEDB data provider)

  • SQLCECA40.DLL

  • SQLCECOMPACT40.DLL

  • SQLCEER40xx.DLL

  • System.Data.SqlServerCe.dll (ADO.NET data provider)

  • System.Data.SqlServerCe.Entity.dll (Entity Framework data provider)

Final Application Deployment for Applications that use Private Deployment for SQL Server Compact

When you create the installer for an application that uses private deployment for SQL Server Compact 4.0, it must contain the binaries for SQL Server Compact in addition to the binaries for your application.

To privately deploy SQL Server Compact 4.0 with your application, the installer must, at a minimum, contain the following SQL Server Compact assemblies and native libraries:

  • The ADO.NET data provider (System.Data.SqlServerCe.dll). For private deployment, this file is in the following directory: %Program Files%\Microsoft SQL Server Compact Edition\v4.0\Private. (If your application uses the Entity Framework, System.Data.SqlServerCe.Entity.dll should be included from the same directory.)

  • The following native libraries: sqlceme40.dll, sqlceqp40.dll, sqlcese40.dll, and sqlceer40xx.dll. The native binaries are in the following directory: %Program Files%\Microsoft SQL Server Compact Edition\v4.0\Private\amd64 and %Program Files%\Microsoft SQL Server Compact Edition\v4.0\Private\x86.

You should add the %Program Files%\Microsoft SQL Server Compact Edition\v4.0\Private\amd64 and %Program Files%\Microsoft SQL Server Compact Edition\v4.0\Private\x86 in your project while creation of the project in Visual Studio.

If you are using ClickOnce to publish your application, make sure that SQL Server Compact 4.0 is not selected as a prerequisite. If SQL Server Compact is selected as a prerequisite, the installer will perform a central deployment of SQL Server Compact when your application is installed. In this case, your application will use the centrally installed instance of SQL Server Compact, rather than the SQL Server Compact assemblies deployed in its application path.

See Also

Concepts

Installing and Deploying on a Desktop (SQL Server Compact)

Private Deployment vs. Central Deployment (SQL Server Compact)

Building Applications for Desktops (SQL Server Compact)