Nine, VS. NET Installation Project VS. Other deployment Scenarios
Body:
In the first part of this article, we saw how to deploy a asp.net Web application in a variety of different ways, including Xcopy deployment, VS. NET's "Copy Project" feature, VS. NET Web Setup project. In this section, we will learn how to build a complex Windows Installer with the functionality provided by the Vs.net Web Setup project. In this process, we will also see how to use the many deployment editors that are available with the Vs.net Web Setup project template.
One, different types of deployment editors
When we deploy an application, we may need to perform a variety of special installation actions, such as setting the structure of the directory installed on the target server, adding a registry key, checking the launch conditions, and adjusting the user interface that appears during installation. Vs. NET provides a very powerful and flexible Web installation project, and we can easily accomplish these tasks. Vs. NET provides the following deployment editors:
⑴ File System Editor: Add files to the installation package.
⑵ Registry Editor: Defines the registration keys to be created on the target machine.
⑶ File Type Editor: Allows the file name extension to be associated with the application, which starts automatically when the user opens a file with the specified extension.
⑷ User Interface Editor: Specifies and sets the properties of the predefined dialog boxes that are displayed during installation on the target computer.
⑸ Custom Action Editor: Specifies additional actions to be performed on the target computer at the end of the installation, such as running a program that associates a server component with a specific message queue. The custom action must be compiled as a. dll or. exe file, or added to a project as a script or assembly, only to be added to the deployment project. Custom actions can only run after the installation is complete.
⑹ Launch Condition Editor: Specifies the conditions that must be met to successfully run Setup. For example, check for a specific version of the operating system. If the user installs on a system that does not meet the criteria, the installation will not proceed.
Next we go through the examples to learn more about the use of the various editors mentioned above.
Second, the File System Editor
You can also guess from the name of this editor that the function of the file System Editor is to add project output files, assemblies, and other files to a specific directory of the deployment project. With this editor, we can also specify which directory location the files are to be installed on the user's computer. The file System Editor can be opened in the following ways: Select Menu "View" → "editor" → "File system".
The file System Editor has predefined many special folders that we can select as the application's installation directory. With these special folders defined by the File System Editor, we can even select the location on the target computer where the exact path is not known. The predefined folders provided by the file System Editor mainly include:
⑴ Application Folder: The application folder can usually be represented by a [programfilesfolder][manufacturer][productname] path. where manufacturer (vendor) and ProductName values are obtained from the settings of the project properties.
⑵global Assembly Cache folder: The Global assembly Buffer folder. Allows the assembly to be installed as a shared assembly on the target computer.
⑶ User desktop: The location where the desktop item is saved. The default path for this folder is [Drivename]\documents and Settings\[username]\desktop, where UserName is the name of the user who is currently performing the installation.
⑷ the user's Program menu: the location where the program menu item is placed on the user's computer. The default path is [Drivename]\documents and Settings\[username]\start Menu\Programs, where UserName is the name of the user who is currently performing the installation.
As an example, we assume that you want to install an assembly of an application into the Global Assembly cache folder. Select Menu "View" → "editor" → "File system", open File System Editor, then right-click "File system on target computer" and select "Add special folder" → "Global Assembly cache Folder". After you join the Global Assembly cache folder, it appears as a child node of the file system on the target computer. You can then add the required assemblies to the global Assembly cache folder by right-clicking the Global Assembly cache folder subnode and selecting the menu add → assembly, in the Component Selector dialog box, the Select the assembly you want to add. After you add an assembly to the global Assembly cache folder subnode, the installer automatically copies the assembly to the global Assembly cache folder on the target machine.
Third, Registry Editor
As the name suggests, Registry Editor is used to manage registry settings on the target machine. By default, Registry Editor displays the standard Windows registry keys, including HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, and HKEY_USERS, as shown in Figure I. We can add any registry keys under these keys.
Figure I
Because the Registry Editor displays content that represents the structure of the registry on the target machine, it actually provides a visualizer to edit the registry key on the target machine, where the registration key is added automatically to the target machine's registry when it is installed. Let's say we're going to add a registration key under HKEY_LOCAL_MACHINE: Right click on HKEY_LOCAL_MACHINE, select Menu "New Key" and name the newly added child node as software. Now right click on the software node and join the child node MyCompany. In the same way, the sub-node ConfigurationSettings is added under MyCompany. Right-click the ConfigurationSettings node, select "New" → "string value", change the name of the string value to Dbconnectionstring, and then set the appropriate value. Once set, the contents of the Registry Editor are shown in Figure two.
Figure II
After the application is installed on the target machine, the registry on the target machine will also contain the connectionstring shown in figure two.
Iv. File Type Editor
The file Type Editor allows you to set up file associations that require setup to be established on the target machine, and to associate a specific file name extension with the application to start when you take various actions on the class file. After an association is established, the extension of the class file and its description appear in Windows Explorer. The mechanism provided by the file Editor is useful if your application uses a custom file type, and you must start a separate external application when performing various operations on such files.
In Vs.net, select the menu "View" → "editor" → "file type" to open the file Type editor. The following table shows the important association properties that should be set when you associate a file name extension to a particular application.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.