Deploying Windows Applications with Visual Studio.NET, Part 2, Page 2
The Registry Editor allows you to manage the Registry settings on the target computer where the application will be installed. By default, the Registry Editor displays the standard Windows Registry keys, such as HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, and HKEY_USERS. By using the Registry Editor, you also can add custom Registry keys under any of the above keys. Selecting View->Editor->Registry from the menu displays the Registry Editor shown in Figure 2.
Figure 2: Registry Editor
To add additional Registry information that your application requires at runtime, you can use either HKEY_LOCAL_MACHINE\Software\[Manufacturer] or HKEY_CURRENT_USER\Software\[Manufacturer]. Be sure to add the application-specific information under the value specified in the Manufacturer property.
File Types Editor
The File Types Editor allows you to set up file associations on the target computer by assigning an application to a file extension. Double-clicking the file in turn launches the correct application. Once the initial association is done, the extension and the file type description appear in the file types list in Windows Explorer. This is very useful if your application uses custom file types that require a separate external application to be launched. The following are important properties associated with the File Types Editor:
- Name—Specifies the name used in the File Types Editor to identify a particular file type
- Command—Sets the executable file that should be launched when the user opens a file with this type
- Description—Provides the description for the file type
- Extensions—Specifies the file extensions with which the executable should be registered
- Icon—Specifies an icon to be displayed for the file type
- MIME—Specifies one or more MIME types to be associated with the selected file type
- Verb—Specifies the verbs (such as open, edit, and play) that are used to invoke the selected action for the file type
Custom Actions Editor
The Custom Actions Editor allows you to link to another program that can be launched at the end of the application install. To create a custom action, you need to create a .dll or .exe file that performs the custom action and add it to the deployment project. The custom actions can be launched only at the end of the installation. Custom actions can be associated with any one of the following four installation outcomes:
For example, if you want to launch a specific external program after installing the application, you can accomplish this by associating that external program with the Install node.
Launch Conditions Editor
By using the Launch Conditions Editor, you can specify conditions that must be met in order for the setup to run. If the user tries to install the application on a system that does not meet the launch conditions, the setup will not run. While setting the launch condition, you also can specify that searches be performed on the target computer to determine the existence of items such as a particular file, Registry key, component, and so on.
This editor has two sections to specify the requirements:
- Search Target Machine—Allows you to specify the kind of search that needs to be performed on the target computer (may include search for a specific file, Registry key, and so on)
- Launch Conditions—Allows you to define the conditions that need to be met to before allowing the application setup to be launched (one is already defined for the setup application)
For example, by using the Launch Conditions Editor, you can configure any of the following conditions:
- File Launch—Searches for installed files on the target system
- Registry Launch—Searches for Registry keys before the start of the installation
- Windows Installer Launch—Searches for Windows Installer files
- .NET Framework Launch—Checks for the .NET Framework on the target computer
- Internet Information Services Launch—Check for the installed version of IIS
While adding the primary output of the FormattingApplication project to the installer, you excluded the .NET runtime file (dotnetfxredist_x86_enu.msm) from the installer package. Therefore, you will check for the existence of the .NET runtime on the target computer by using the .NET Framework launch condition. To do this, you need to perform the following steps:
- Open the Launch Conditions Editor by selecting View | Editor | Launch Conditions.
- Add a launch condition using the Action | Add .NET Framework Launch Condition menu. Set the Name property to CHECKDOTNETCONDITION.
Now that you have set this launch condition, if the user tries to run the installation without having the .NET Framework installed, the installation will not run.