Telerik OpenAccess Classic

Telerik OpenAccess ORM Send comments on this topic.
How to: Deploy applications using windows installer
Programmer's Guide > OpenAccess ORM Classic (Old API) > OpenAccess Tasks > Integration and Installation > How to: Deploy applications using windows installer

Glossary Item Box

This documentation article is a legacy resource describing the functionality of the deprecated OpenAccess Classic only. The contemporary documentation of Telerik OpenAccess ORM is available here.

This article demonstrates the process of creating an installer for a Windows-based application. In this how to we will create an installer that sets up shortcuts and file associations, adds an entry to the registry, displays custom dialog boxes, and checks the version of OpenAccess during installation.

Prerequisites:

The Northwind Sample application that we will deploy can be found here. Note that you might need to change the references to your current OpenAccess version.

 

To create a deployment project:

  1. Open the solution containing the Northwind Sample application.
  2. On the File menu, point to Add, and then click New Project.
  3. In the Add New Project dialog box, in the Project Types pane, open the Other Project Types node, click Setup and Deployment Projects, and then click Setup Project in the Templates pane. In the Name box, type NorthwindSampleInstallator.
  4. Click OK to close the dialog box.The project is added to Solution Explorer, and the File System Editor opens.
  5. Select the NorthwindSampleInstallator project in Solution Explorer. In the Properties window, select the ProductName property and type Northwind.

Note that the ProductName property specifies the name that will be displayed for the application in folder names and in the Add or Remove Programs dialog box.

To add the Windows-based application to the installer:

  1. Select the NorthwindSampleInstallator project in Solution Explorer. In the File System Editor, select the Application Folder node.
  2. On the Project menu, point to Add, and then click Project Output.
  3. In the Add Project Output Group dialog box, select NorthwindSampleApplication from the Project list.
  4. Select the Primary Output group from the list. In the Configuration box, select (Active). Click OK to close the dialog box.
  5. On the Build menu, click Build NorthwindSampleInstallator.

Adding assembly references:

  1. Select the NorthwindSampleInstallator project in Solution Explorer.
  2. On the Project menu, point to Add, and then click Assembly.
  3. Add those assemblies:
    • Telerik.OpenAccess.Config
    • Telerik.OpenAccess.Runtime
  4. On the Build menu, click Build NorthwindSampleInstallator.

At this point you should have a working installer to deploy your project. Note that the steps that follow are optional and their aim is to show how flexible a Windows Installer can be.

To create shortcuts for the Windows-based application:

  1. Select the NorthwindSampleInstallator project in Solution Explorer.
  2. In the File System Editor, select the Primary output from NorthwindSampleApplication.
  3. On the Action menu, click Create Shortcut to Primary Output from NorthwindSampleApplication.
  4. Rename the shortcut Shortcut to NorthwindSample.
  5. Select Shortcut to NorthwindSample and drag it to the User's Desktop folder in the left pane.

Adding a Custom Installation Dialog Box:

This step adds and configures a custom user interface dialog box that will be displayed during installation.

To add a custom installation dialog box:

  1. Select the My NorthwindSampleInstallator project in Solution Explorer. On the View menu, point to Editor, and click User Interface. The User Interface Editor appears.
  2. In the User Interface Editor, select the Start node (under the Install node).
  3. On the Action menu, click Add Dialog.
  4. In the Add Dialog dialog box, select Checkboxes (A).
  5. Click OK to close the dialog box.
  6. Right-click the Checkboxes (A) dialog box and select Move Up two times to position it above the Installation Folder dialog box.
  7. In the Properties window, set the BannerText property to Documentation.
  8. Set the BodyText property to the following:Do you want to install the documentation along with the product?
  9. Set the CheckBox1Label property to Yes Install the documentation.
  10. Set the properties Checkbox2Visible, Checkbox3Visible, and Checkbox4Visible to False. This will hide the additional check boxes.

To add a Documentation folder:

  1. Select the NorthwindSampleInstallator project in Solution Explorer. On the View menu, point to Editor, and click File System. Select Application Folder if it is not already selected.
  2. Right-click Application Folder, point to Add, and then click Folder.
  3. Rename New Folder #1 as Documentation.

To add the Documentation to the installer:

  1. Select the NorthwindSampleInstallator project in Solution Explorer. On the View menu, point to Editor, point to File System, and select the Documentation folder.
  2. From the Action menu, point to Add, and then click File. Add any file that you want to be installed with your product as documentation.
  3. Select the files you added in the File System Editor.
  4. In the Properties window, set the Condition property to CHECKBOXA1=1. When the installer is run, the files will be installed only if the custom check box is selected.

Adding Launch Conditions:

This step verifies whether Telerik’s OpenAccess version 2009.1.405.1 or a later is installed on a target computer, and if not found the installation is rolled back.

To add a launch condition to check the OpenAccess version:

  1. Select the NorthwindSampleInstallator project in Solution Explorer. On the View menu, point to Editor, and then click Launch Conditions.
    This step is intended only to demonstrate the concept of launch conditions; the Northwind Sample Application has no actual dependency on the OpenAccess dlls as they are being deployed together with the application.
  2. In the Launch Conditions Editor, select the Requirements on Target Machine node.
  3. On the Action menu, click Add File Launch Condition.A Search for File1 node is added beneath the Search Target Machine node, and a Condition1 node is added beneath the Launch Conditions node.
  4. Rename Search for File1 to Search for Telerik.OpenAccess.
  5. In the Properties window, set the FileName property to Telerik.OpenAccess.dll, the Folder property to [ProgramFilesFolder], the Depth property to 3, and the MinVersion property to 2009.1.405.1.
  6. Select the Condition1 node.
  7. Set the Message property to the following:

This program requires Telerik’s OpenAccess version 2009.1.405.1 or later. Please install Telerik’s OpenAccess and rerun the NorthwindSampleInstallator.

Setting Properties for Prerequisite Components:

This step sets a property to install the .NET Framework automatically if the correct version is not present on the target computer. Note that the .NET Framework 2.0 package will also install the Windows Installer 2.0 files.

When the prerequisites properties are set as follows, clicking setup.exe will automatically install the .NET Framework before it runs the .msi file.

  1. Right click on NorthwindSampleInstallator from the Solution Explorer and select properties.
  2. Click on Prerequisite.
  3. Set any components that you would like to install prior to your project deployment

Note that from here you can set the locations of the required files as well.

Deploying the Northwind Database together with the application:

You can easily deploy the database together with the application. For the purpose of this you will need to modify the App.config of the ClassLibrary project. Replace the connections node in the app.config with the following code:

app.config Copy Code
<connections>
     
<connection id="DatabaseConnection1">
       
<databasename>Northwind12</databasename>
       
<servername>.\SQLEXPRESS</servername>
       
<integratedSecurity>True</integratedSecurity>
   
<connectionParams>AttachDbFilename=|DataDirectory|\NORTHWND.MDF;</connectionParams>
   
<backendconfigurationname>mssqlConfiguration</backendconfigurationname>   
     
</connection>
   
</connections>

This code will specify the path to the deployed database. |DataDirectory| is representing the path where the project is installed.

Adding the database to the project:

  1. Select the NorthwindSampleInstallator project in Solution Explorer. On the View menu, point to Editor, point to File System, and select the Application folder.
  2. From the Action menu, point to Add, and then click File. Add the Northwnd.mdf file.

Deploying to another computer:

This step will run the installer and install My Notepad on another computer.

To deploy My Notepad to another computer:

  1. In Windows Explorer, navigate to your project directory and find the built installer. It should be located in the NorthwindSampleInstallator folder eighter in release or debug (depending on the project configuration)
  2. Copy My NorthwindSampleInstallator.msi, Setup.exe, and all other files and subdirectories in the directory to another computer.
  3. On the target computer, double-click Setup.exe to run the installer.

You will need to have install permissions on the targeted computer in order to run the installer.