6.2 VS. NET Web installation project features
The deployment project in VS. NET is based on the functions of Windows Installer. You can perform the following operations:
(1) read and write registration keys.
(2) create a directory in the Windows File System of the target server.
(3) provides a mechanism for registering components.
(4) provides a mechanism to collect information from users during installation.
Allow allows you to set startup conditions, such as checking the username, computer name, current operating system, installed software, and whether. net clr has been installed.
Idea allows you to run custom configuration programs or scripts after the installation is complete.
In the following section, we will learn how to use the VS. NET Web installation project to deploy DeploymentExampleWebApp.
7. Create a Web installation project
First, DeploymentExampleApp ASP. create a Web installer project in the. NET Web application solution: Select File> New> project. In the Create Project dialog box, specify the project type "installation and deployment project" and the template "Web Installation Project", as shown in Figure 5.
Figure 5
After creating a project, add the Assembly and content files of ASP. NET Web applications to the installation project. In Solution Explorer, right-click the DeploymentExampleWebAppSetup project, select "add"> "project output", and select DeploymentExampleWebApp in the "add project output group" dialog box, select "primary output" and "six" from the list.
Figure 6
After adding the project output, add the relevant content files (including. aspx files and graphic files) to the project. Open the "add project output group" dialog box again. This time, select "Content File" and "7" from the list.
Figure 7
After "main output" and "Content File" are added to the Web installation project, solution resource manager should be shown in Class 8.
Figure 8
You can set many properties in the Properties window of the Web installation project. These properties determine the content and behavior of the Windows Installation File during running. In solution manager, right-click DeploymentExampleWebAppSetup and select "properties" to open the attribute setting window in Figure 9.
Figure 9
As shown in Figure 9, the attribute window allows you to set the author, product description, vendor, support phone number, and other information, which may be very useful to end users of the application.
8. Install ASP. NET Web applications
Create a Windows installation file (. then install ASP on the target server. NET application is very convenient, as long as you double-click in Windows Resource Manager. the Installation Wizard starts and guides you through the installation process. Figure 10 shows the first dialog box displayed during installation.
Figure 10
Click "Next" in the figure 10 dialog box. The dialog box shown in Figure 11 appears. You can specify the virtual directory to which the Web application is installed. This is one of the most convenient features of VS. NET Web installation projects. virtual directory creation has been fully automated and does not require manual operations. In the second part of this article, we will see how to set special properties of the virtual directory during installation, such as Directory Security.
Figure 11
In the dialog box shown in Figure 11, click "disk overhead" to learn about the disk space required to install the Web application. Click "Next". The dialog box shown in Figure 12 is displayed. The Wizard asks us to confirm the installation.
Figure 12
If you click "Next" in the dialog box in figure 12, the installation starts and the application is installed on the Web server. If the application is successfully installed, the dialog box shown in Figure 13 is displayed.
Figure 13
After the application is installed, you can see the ASP.. NET application. In the future, we can uninstall the ASP.. NET Web applications.
IX. Conclusion
XCOPY and "Copy project" are both good deployment technologies. Their main features are simple, but manual operations are required. They are very suitable for applications with relatively simple installation process, but in some cases, we need to perform more complex operations during the installation process. In this case, it is best to use the Windows Installer technology to deploy the application. Deploying ASP. NET Web applications with Windows Installer has the following advantages:
(1) If an application installed with Windows Installer is damaged, you can use the repair function of the Windows installation package to repair it. If other deployment methods are used, damaged components must be replaced manually.
(2) When using Windows Installer technology, we can also take advantage of the automatic rollback feature. When the installation process fails, the automatic rollback function not only ensures that the installed components are deleted correctly, but also ensures that the machine can be restored to the status before the installation program starts.
(3) Because Windows Installer uses a. msi installation database to save all the installation information, it is possible to obtain information such as the files copied and the registration keys created.
(4) If ASP.. NET Applications must be distributed to multiple users (or packaged and sold). A convenient and automatic deployment mechanism is essential, manual operations such as XCOPY deployment are obviously not suitable. If Windows Installer is a mature and powerful installation technology, the entire installation process can be automated, greatly simplifying application deployment.
This section demonstrates various methods for encapsulating and deploying ASP. NET Web applications, describes how to leverage the advantages of Windows Installer technology, and the specific process of creating. msi. In the next part of this article, we will add various advanced features based on the previous Windows Installer example, such as the customized installation dialog box and Its Appearance Order, and how to add the registration key and create a custom folder during the installation process.