Getting Started with Visual Studio LightSwitch - Part 10: Deploying the LightSwitch Application

This is the final part in this series of article on Visual Studio Light Switch Application, where we are going to see the different options available for deploying the Light Switch Application in real time. In our earlier articles we have seen in detail on developing the application, handling data, validating data and using latest features that are available and released in the recent version of Visual Studio IDE. With Visual Studio IDE we can develop Light Switch application and have the capability to publish it to Windows Azure and also to IIS Server as per our requirement.

This tutorial will focus mainly on the different steps that are involved in publishing the application to IIS Server. Since we don’t have a server in place with a database we will just see the steps that are involved in publishing as a package which can be made a msi and can be used in servers to publish as a package. Let us see the step by step process on how to achieve this task on deploying the Visual Studio Light Switch Application.

Steps:

Open Visual Studio 2012 IDE in administrator mode and select the application, which we are going to publish (We will take the sample application that we developed in Part 8 of this series) as shown in the screen below:

To start publishing the application, right click on the Project Name in the solution explorer and select Properties from the list or directly double click the Property option in the solution explorer listed as shown in the screen below:

In the Properties, select the option Application Type in the left menu and select if we want to deploy this application as a Desktop version or a Web version as shown in the screen below:

Select Web option and click on Publish button at the right side of the window to start publishing the application. We can see a Publish Wizard opened as shown in the screen below:

We can see 3 different options to deploy the application, initially in the previous release we have option for Desktop or Web. But with this new release we have option to deploy as a service specifically for using the OData service a standard web-based protocol for accessing data via services. Select the web option and click on Next button as shown in the screen below:

Clicking on Next will show the options to where we want to deploy the application, if we want to deploy to local server or to an IIS Server or to a Windows Azure environment as per our requirement. Here we will select IIS Server and we also see an option to Import setting, if we have a setting that has been saved then we can use it either to have the default values. Since we don’t have any setting saved we will simply select IIS Server and click on Next button as shown in the screen below:

Next, we can see how we want to package the application and publish, as we have option to simply package the application and use as a .MSI package to deploy it where ever required over the different servers or directly we can remote publish the application. Say in remote publish we need to make sure the server has the appropriate IIS Server with Light Switch Prerequisites and a SQL Server in place to handle the database. If we are not sure on the things that are required in the remote server, go with Package creation by selecting Create a package on disk option and provide the path to where the package should be created and also the name of the package as shown in the screen below:

Next step is to configure if the user need to connect as a secure website or a normal website through Http and Https protocol. We can select it appropriately and click on Next button as shown in the screen below:

This step is very important, were we need to handle the database and how the database will be published. If we want to script the database with all the dependency and stuffs we can select the first option on Generate a new database called option and provide a valid name of the database. Else we can go with using the existing available database to use, where we need to provide a valid connection string. Since we don’t have any valid database in place we will go with creating a new database as shown in the screen below:

If we have any certificate in place like SSL etc., we can select this option else simply leave it and click on next and we can see a summary as shown in the screen below:

Click on Publish will start creating the package, which we can use it across the servers to start deploying the application and use the Visual Studio Light Switch application over the browser. While creating the package and publish option Visual Studio will provide the steps involved in creating the package as shown in the screen below:

Navigate to the path you provided to save the package and we can see a list of files available along with the package which can be used to deploy the application to different servers as shown in the screen below:

Conclusion:

So in this article we have seen what are the different ways to deploy your Visual Studio Light Switch application locally and remotely step by step by creating a package and using it across in different servers. This is the final article in this series on Visual Studio Light Switch Application development.