Deploying Visual Studio LightSwitch Beta 1 2-Tier Desktop Applications

[Infragistics] Mihail Mateev / Saturday, October 9, 2010

Visual Studio LightSwitch applications are based on the Silverlight Framework. Therefore, the deployment of these 2-tier and multi-tier applications  is of particular interest to developers.

This article will examine ways of deployment of the 2-tier desktop LightSwitch applications .

In Visual Studio LightSwitch deploying of applications is via using ClickOnce deployment. ClickOnce is a deployment technology that enables you to create self-updating applications that can be installed and run with minimal user interaction. The process of deploying a LightSwitch application differs depending on the application type and deployment topology

  

 

There are three types of LightSwitch applications by deployment:

  • LightSwitch application with a desktop client (Out-of-Browser Silverlight application) and 2 tier deployment.
    (creates an application that runs on the end-user’s Windows desktop; the database and server components run on a networked computer)
  • LightSwitch application with a desktop client (Out-of-Browser Silverlight application) and 3 tier deployment.
    (creates an application that runs on the end-user’s Windows desktop; the database and server components run on an Internet Information Services (IIS) server)
  • LightSwicth application with a browser client (Silverlight application) and 3 tier deployment.
    (creates an application that runs in the end-user’s web browser; the database and server components run on an Internet Information Services (IIS) server)

It is very easy to change the way of the deployment: just need to change the option in LightSwitch application –> Properties –> Application Type.

Developers work in the same way despite of the application type option.

There are two ways to deploy a LightSwitch application, by either publishing or packaging it. In either case, the LightSwitch Publish Application Wizard guides you through the deployment process.

  • A published application can be run on client computers immediately after the wizard has been completed. The application is ready to install and the installation automatically deploys the database schema to SQL Server.
  • A packaged application means that everything that is required to run the application is bundled together, but additional steps must be taken to make the application available to the user.

Sample Application:

Demo application is based on the application used for article: “Introduction to Visual Studio LightSwitch”

Requirements:

SQL Server 2008 Express or higher license

Steps to reproduce:

  • Download a sample application from the article: “Introduction to Visual Studio LightSwitch”
  • Deploy the application as 2 tier application with a desktop client (using both Publish and Package application).
  • Run the Installed Application

 

Deploy the application as 2 tier application with a desktop client (using both Publish and Package application).

Deploy the application as 2 tier application with a desktop client using both Publish option.

Open the InfraOrders solution:

Ensure that in InfraOrders project –> Properties –> Application Type. 2-tier deployment is selected option

Click on the project in the Solution Explorer and select “Publish”

  

Ensure the selected configuration: Selected option is “Desktop client in a 2-tier deployment”: and select “Next”.

  

Select the Deployment option: “Publish” and select “Next”

 

  

On the Specify Application Database screen ensure that connection string is correct:

  

In the “Insert Prerequisites screen” select dependencies, that need to be installed.

  

Select “Publish” and finish the deployment.

  

Open the SQL Server 2008 Management Studio and ensure there has created a database, named “InfraOrders”.

   

Open the [InfraOrders project folder]\Publish folder. There is an Installation of the 2-tier Out-of-Browser application).

  

Run the “Setup.exe” file and install the application.

  

Select from the Start menu installed application.

   

Run the application:

  

The test application doesn’t display data. The reason is that only structure of the database is created when
a LightSwitch application is published.

Deploy the application as 2 tier application with a desktop client using both Package application option.

Select again InfraOrders project from the Solution explorer and from context menu select “Publish”.
Confirm the selected configuration: “Desktop client in a 2-tier deployment”.

Select the Deployment option: “Create a script to install and configure the database” and click “Next”

  

On the Specify Application Database screen check that database name correct:

  

In the “Insert Prerequisites screen” select dependencies, that need to be installed.

  

Ensure the primary connection string for the database and finish the deployment process.

  

Database is not created on the SQL 2008 server

In the [InfraOrders project folder]\Publish folder there is InfraOrder.sql script, that needs to create a database.

 

  

Install.htm document contains an instruction how to create a database.

  

Follow instructions, run the script to create a database and install the application via setup.exe.

Run the application.