Walkthrough: Deploying an Occasionally Connected Client Application with the Local Database

Deploying an occasionally connected application together with the local SQL Server Compact 3.5 database is not any more difficult than deploying any SQL Server Compact 3.5 database together with an application.

Note

ClickOnce is the preferred method of deployment for applications that include SQL Server Compact 3.5 databases (as opposed to creating a custom action in a Setup and Deployment project).

This walkthrough provides step-by-step instructions for deploying the application and local database cache that were created in the Walkthrough: Creating an N-Tier Data Application topic.

During this walkthrough, you will learn how to perform the following tasks:

  • Configure an application for ClickOnce deployment.

  • Publish the install package.

  • Create an install package.

  • Test the deployment.

Prerequisites

To complete this walkthrough, you need to have completed the solution and project created in Walkthrough: Creating an Occasionally Connected Application.

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.

Opening the OCSWalkthrough Solution

Because this walkthrough deploys the OCSWalkthrough solution, this solution must first be loaded into Visual Studio.

To open the OCSWalkthrough solution

Configuring Deployment

Because ClickOnce Security and Deployment is the preferred method of deployment for applications that include SQL Server Compact 3.5 databases, you will open the Publish Page, Project Designer and configure the OCSWalkthrough application for deployment.

To open the publish page and configure ClickOnce deployment

  1. To open the Project Designer, in Solution Explorer, double-click My Project if you are working on a Visual Basic project. (Double-click Properties if you are working on a C# project.)

  2. Click the Publish tab.

  3. Click Application Files and set the .sdf file to Data File (Auto).

    This setting notifies the installer to treat this as a local data file and to put it in the data directory.

  4. Click Prerequisites and select SQL Server Compact 3.5.

    This setting notifies the installer to check whether the SQL Server Compact 3.5 runtime exists and to install it from the Internet if it is not found.

Creating the Installer

After the publish information is configured, set the location to publish the application's installer to, and then create the installer.

To create the installer

  1. In the Publishing Location box, type the Web site, FTP server, or file path to publish the installer to.

  2. Click Publish Now to create the installer.

Testing the Application

To verify deployment

  1. Navigate to the location where you published the installer.

  2. Install the application.

See Also

Tasks

How to: Configure Data Synchronization in an Application

Walkthrough: Creating an Occasionally Connected Application

How to: Configure a Local and Remote Database for Bidirectional Synchronization

Concepts

SQL Server Compact 3.5 and Visual Studio

Other Resources

Accessing Data in Visual Studio