The File Types Editor
The File Types Editor can be used to create the required registry to establish a file association for the application being installed. A file association is simply a link between a particular file extension and a particular application. For example, the file extension .xls is normally associated with Microsoft Excel.
- Add and Delete Document Types and Associated File Extensions in the File Types Editor.
- The File Types Editor can be used to specify document types and file extensions that will be associated with your application when it is installed on a target computer.
- Once installed, the extension and file type description will appear in the file types list in Windows.
There are three steps involved in associating a file type with your application:
1. adding a document type
2. associating a file extension
3. and associating an executable file
To add a document type
1. Select the File Types on Target Machine node in the File Types Editor.
2. On the Action menu, click Add File Type.
3. A new document type node is added and the default name is highlighted.
4. Type a descriptive name for the new document type.
To associate a file extension
1. Select a Document Type node in the File Types Editor.
2. In the Properties window, select the Extensions property and type an extension.
Note : Valid file extensions cannot be preceded by a period — enter the extension using the form xxx rather than .xxx. You can enter multiple extensions by separating them with a semicolon (xxx;yyy).
To associate an executable file
1. Select a Document Type node in the File Types Editor.
2. In the Properties window, click the ellipsis button () next to the Command property.
3. In the Select item in project dialog box, click the Add File button.
4. Select an executable file to associate with the file type.
Note A file type can only be associated with one installed executable file. To associate more than one executable file with a file type, you must first specify conditions for each executable file to ensure that only one will be installed for a given installation.
The User Interface Editor
The Interface Editor is used to manage the application installation interface. The editor allows us to define the dialog boxes that are displayed to the user and in what order they are shown.
The editor uses a treeview with two root nodes: Install and Admin. Below each of these nodes there are three nodes that represent the stages of the installation: Start, Progress, and End. Each of the three stages can contain a number of dialog boxes that will be displayed to the user when the resulting Windows Installer package is run. A default set of dialog box is predefined when we create the deployment project. The default dialog boxes that are present depend on the type of deployment project; Setup Project or Web Setup Project. However, if you are creating a Web Setup Project the Installation Folder dialog box will be replaced by an Installation Address dialog box.
Installation Mode
We’ll start by taking a look at the two modes that the installation runs: Install and Admin. These basically distinguish between an end user installing and a system administrator performing a network setup.
To use the Admin mode of the resulting Windows Installer Package msiexec.exe can be used with the /a command line parameter.
msiexec.exe /a
The Start Stage
The Start stage is the first stage of the installation and contains the dialog boxes that need to be displayed to user before the actual installation of the files begins. This stage is commonly used to ask the user to select the base installation folder for the application and to ask the user what parts of the system he would like to install. Another very commonly task of this stage is to ask the user what their name is and what organization they work for. At the end of this stage the Windows installer service will determine how much disk space is required on the target machine and check that this amount of space is available. If the space is not available, the user will receive an error and the installation will not continue.
The Progress stage
The progress stage is the second stage of the installer and is where the actual installation of the file occurs. There isn’t usually interaction in this stage of installation. There is normally one dialog box that indicated the current progress of the installation. The current progress of the installation is calculated automatically
The End Stage
One the actual installation of the files has finished, the installer moves into the End stage. The most common use of this stage is to inform the user that the installation has completed successfully. It is often used to provide the option of running the application straight away or to view any release notes.
The Custom Actions Editor
The Custom Actions Editor allows the developer specify additional actions to be performed on the target computer at the end of an installation. For example, he might want to run a program that associates a server component with a particular message queue.
Custom actions must be compiled as a .dll or .exe file, or added to a project as a script or assembly before they can be added to a deployment project. Actions can only be run at the end of an installation.
The editor contains four folders, each corresponding with a phase of installation: Install, Commit, Rollback, and Uninstall.
Custom actions are run in the same order that they are displayed in the editor. Custom actions can be reordered via dragging with the mouse or via the Cut and Paste commands on the Edit menu.
Adding and Removing Custom Actions in the Custom Actions Editor
The Custom Actions Editor is used to specify custom actions to be run during installation on a target computer. Cstom actions that are contained in the outputs of a project can be added in the solution, including .dll files, .exe files, or Microsoft .NET Framework installation components, or compiled custom actions can be added as files or components.
The order of execution can also be controlled for custom actions.
The four actions that are defined in the editor are defined in the following table.
Events and Description
Install – The actions defined for this event will be run when the installation of the files has finished, but before the installation has commited
Commit – The actions defined for this event will be run when the installation has been committed and has therefore been successful.
Rollback – The actions defined for this event will be run when the installation fails and rolls back the machine to the same state as before the install was started.
Uninstall – The actions for this event will be run when the application is being uninstalled from the machine.
To add a custom action
1. Select a folder in the Custom Actions Editor.
2. On the Action menu, choose Add Custom Action.
3. In the Select item in Project dialog box, select a folder and select the .dll file, .exe file, or project output that contains the custom action.
4. If the item hasn’t previously been added to the deployment project, click the Add File, Add Output, or Component button to add the item as a custom action. This also adds the item to your project.
5. Caution If you use the Add File, Add Output, or Component button to add an item to the Select item in project dialog box and subsequently cancel the dialog box, the items are still added to the deployment project. If you don’t want the items in the deployment project, you can remove them via Solution Explorer.
6. Tip To add a custom action to all four folders, select the Custom Actions node in the editor, and choose Add Custom Action.
To change the order of execution
1. Select a custom action in the Custom Actions Editor.
2. On the Action menu, click Move Up or Move Down.
3. Note Custom actions can be reordered by dragging with the mouse or by Cut and Paste commands on the Edit menu.
4. To remove a custom action
5. Select the custom action in the Custom Actions Editor, and choose Delete from the Edit menu.
Properties for the Custom Actions Editor
The following properties are available when working in the Custom Actions Editor. The actual properties available at any given time are dependent on the deployment project type and the current selection in the editor.
A number of searches can be defined to help create launch conditions:
- File search
- Registry search
- Windows Installer search
Predefined launch conditions allow developers add both search and launch condition in a single step. The Property ‘property’ for the search is automatically referenced in the Condition property of the launch condition.
Searches and conditional evaluations are performed at the beginning of an installation and are performed in the order that they are shown in the Launch Conditions Editor.
Adding a File Search in the Launch Conditions Editor
The Launch Conditions Editor can be used to specify a search for a file on a target computer during installation. If the file is not found, the Property ‘property’ can be evaluated for conditional installation. File search properties can also be set to specify the location of the file, or attributes such as version, size, and date.
To add a file search
1. Select the Search Target Machine node in the Launch Conditions Editor.
2. On the Action menu, choose Add File Search.
3. In the Properties window, set the FileName property to the name of the file you wish to find.
4. Set the Property property to a valid Windows Installer property.
Optionally, set additional properties to specify where to search or what attributes to search for.
Adding a Registry Search in the Launch Conditions Editor
The Launch Conditions Editor can be used to specify a search for a registry key on a target computer during installation. The result of the search is returned in the Property property and can be evaluated in a launch condition. The Root property can be set for a registry search to specify a registry root. The Value property can be set to specify a registry value.
To add a registry search
1. Select the Search Target Machine node in the Launch Conditions Editor.
2. On the Action menu, choose Add Registry Search.
3. In the Properties window, set the Root and RegKey properties for the Registry key you wish to find.
4. Optionally, set the Value property to search for a specific value.
To remove a registry search
1. Select the registry search in the Launch Conditions Editor, and choose Delete from the Edit menu.
2. Adding a Windows Installer Search in the Launch Conditions Editor
3. The Launch Conditions Editor can be used to specify a search for a Microsoft Windows Installer component on a target computer during installation. The result of the search is returned in the Property property and can be evaluated in a launch condition.
To add a Windows Installer search
1. Select the Search Target Machine node in the Launch Conditions Editor.
2. On the Action menu, choose Add Component Search.
3. In the Properties window, set the ComponentID property to the GUID of the component you wish to find.
Note The Component ID is a GUID assigned by a package during installation; it does not match any of the deployment project properties. To determine the Component ID, the application must be installed and a tool such as the MSI Spy tool must be used and included in the Windows Installer Software Development Kit.
Building
The final step is concerned with how to build the deployment or setup project has created . There is basically no differences between how a Visual Basic .NET application is built and deployment /Setup project. If the project is the only project contained within the solution then the Build item can be used from the Build menu, which will cause the project to be built. As with the other projects, the developer will be informed of what is happening during the build through the Output Windows.
The Deployment/Setup project can also be built as part of a multiproject solution. If the Build Solution item is chosen from the Build Menu, all the projects in the solution will be built. Any deployment or setup projects will be built last. This is to ensure that if they contain the output from another project the system will pick up the latest build of that project.
Property and Description
(Name) – This is the name given to the selected custom action.
Arguments – Specifies command-line arguments for the selected custom action.
Condition – Specifies a Windows Installer condition that must be satisfied (evaluate to true) in order for the selected custom action to be run at installation time.
CustomActionData – Specifies custom data to be passed to an installer.
EntryPoint – Specifies an entry point within a .dll custom action.
InstallerClass – Specifies whether a custom action is a .NET ProjectInstaller class.
Name – Specifies the name used in the Custom Actions Editor to identify a selected custom action. Defaults to the file name.
SourcePath – Indicates the path to the custom action source file on the development computer. Read-only.
The Launch Conditions Editor
The Launch Conditions Editor allows developers specify conditions. These conditions must be met in order to successfully run an installation. For example, the user might want to check for a specific version of an operating system – if a user attempts to install on a system that does not meet the condition, the installation will not go through.