Publishing the Application

In this lesson, you will learn how to publish an application and deploy it to end users.

Publishing

The final step in creating an application is to distribute it to users. You publish and deploy LightSwitch-based applications by using the LightSwitch Publish Application Wizard. The wizard guides you through the process of publishing the application.

After the application is published, there are several ways to deploy it to end users. The steps to deploy differ depending on the deployment method that you use.

To publish an application

  1. On the Build menu, choose Configuration Manager.

    The Configuration Manager dialog box opens.

  2. In the Active Solution Configuration list, choose Release, and then choose Close.

    This step prevents debugging utilities from being distributed with your application.

  3. On the Build menu, choose Publish My First Application.

    The LightSwitch Publish Application Wizard appears.

  4. On the Welcome to the LightSwitch Publish Wizard page, choose Desktop, and then choose Next.

  5. On the Application Services page, choose Local, and then choose Next.

  6. On the Specify Publishing Preference page, in the Where do you want the application files to be placed? box, accept the default location (the path to your project plus Publish\).

    This publishes the application to a Publish subdirectory in your project directory.

  7. In the How do you want to publish the default database? list, choose Create a script file to install and configure the database, and then choose Next.

  8. On the LightSwitch Application Data – SQL Database Connection page, accept the default connection string, and then choose Next.

  9. On the Database Configuration page, accept the default settings, and then click Next.

  10. On the Application Administrator page, in the Should LightSwitch create the Application Administrator section, choose Yes, create an Application Administrator.

  11. In the User Name box, type your Windows user name, and then choose Next.

  12. On the Install Prerequisites page, accept the default settings, and then click Next.

  13. On the Other Connection Information page, accept the default settings, and then choose Publish.

    The application will be published.

    Tip

    You can monitor the progress in the status bar at the bottom of the IDE. When the process is finished, the message Publish succeeded appears.

To deploy an application

  1. In File Explorer, locate the Publish subdirectory in your project directory.

    Tip

    To find your project directory, select the MyFirstApplication node in Solution Explorer and look at the Project Folder property in the Properties window.

  2. Select the contents of the Publish directory and all its subdirectories, and copy them to a network location or to removable media.

Closer Look

In this lesson, you learned how publish an application. The steps for publishing differ for other application types.

On the third page of the wizard, you specified the location at which to publish the application, in this case the default Publish subdirectory. You can enter any valid file path or network path for a publish location.

You also chose the Create a script file to install and configure the database check box, which creates a script file that runs during installation, after SQL Server is installed and configured. Use this option when you want to install SQL Server as a part of the installation or when you are publishing an application to an existing database.

The other option, Publish directly to the database now, installs the application database to SQL Server during installation. Use this option when SQL Server is already installed and configured on the computers on which the application will be installed.

On the LightSwitch Application Data – SQL Database Connection page, you entered two connection strings. In this case, they were connection strings for the local instance of SQL Server LocalDB, which was installed with LightSwitch. If you're publishing to another computer, you have to know the connection string for the instance of SQL Server on that computer. In that case, choosing to install with a script file might be a better choice.

On the Application Administrator page, you chose to deploy authentication with the application, and you defined a default administrator user account and password. This user account automatically provides the Security Administration permission that enables the application administrator to add users and assign roles. Remember the user name and password. You need them to run the application.

Note

You should only deploy the authentication information the first time that you deploy the application. Attempting to deploy the authentication information again causes publishing to fail.

On the Install Prerequisites page, you chose to install only the default prerequisites--the items that are shown in bold text. If you know that the computers where the application will be installed have additional dependencies, you can choose to install those as prerequisites also. Prerequisites can be downloaded from the Internet or from a network share that contains the necessary files.

On the final page, you accepted the default connection strings for the additional data source that the application uses: NorthwindEntitiesData. If you connect to an external database, you must obtain a connection string from the database administrator.

Next Steps

In the next lesson, you will install and run the application.

Next lesson: Running the Application

See Also

Concepts

How to: Deploy a 2-tier Application

Other Resources

Distributing Your Application

Deployment: Distributing and Maintaining Your Application