. Net Web project installation package Creation

Source: Internet
Author: User
Tags introductions microsoft website
. NET web project installation package Creation

Recently, the company requires that OA be installed to facilitate the installation of implementation personnel on the customer's machine.

I used vs2003 to package web projects several years ago, but I have forgotten it.

So the first idea is to use search engine search. There are many introductions on the Internet, but some of them are rough and I don't quite understand. It may be clear and clear to practice it.

 

Create a new Web installation project in the test web project, such:

 

In the newly created installation project, right-click the project, for example:

 

Select project output and select the project to be output, for example:

If I select a Web site, only the content output option is available. Select "OK" for the selected content file.

If you select a web project, such:

 

Right-click the project and click Properties, as shown in:

Click required again:

These components to be included in the package are mainly. NET Framework components. We need to package them in.

Here, we hook. NET Framework 2.0 (x86), and select the second option for the installation location of the required system components below, so that the components involved will be followed up with the installation package.

The first is to download components from the Microsoft website, and the third is to specify a custom location.

 

Click OK. Next, right-click the project, for example:

Click the start condition, for example:

We can see the startup conditions. Let's take a look at the IIS conditions, right-click the IIS conditions, and view the Properties window, such:

 

Here we can see the setting conditions. IISVERSION> = "#5" indicates that the IIS version must be later than 5.0. If the IIS version is later than 6.0, It is IISVERSION> = "#6 ".

 

Next we will set the installation interface. Right-click the project, for example:

Click the user interface, for example:

Here, I have added three steps: License Agreement, customer information, and text box (.

Right-click Start and click the Add dialog box, as shown in:

To select the required steps.

 

Right-click the license agreement step and view the attributes as follows:

We know that when installing a lot of software, there will be a license agreement, and then let's click agree, and then next, here.

We have added a license. rtf file to the installation project. You can select this file here.

 

Because the database needs to be set during the installation process, we also need to ask the installation user to enter the database server information during the installation process. Here is the step of text box (. Right-click the step to view the Properties window, as shown in:

There are four text boxes available here. We only need three database servers, accounts, and passwords, so the fourth Visible is set to false.

 

To configure the database, we need to create another project, create a class library project, and add an installation class, such:

Generate an installation class, for example, a class that inherits the Installer class.

 

Then we need to write code in the installation class.

We override the Install method:

public override void Install(IDictionary stateSaver)

Here we need to write the configuration database information.

 

Then we add this project to the installation project, for example:

Right-click the installation project, for example:

If you select a custom operation, the custom operation interface is displayed, as shown in the following figure:

Then, in the installation operation, add the newly created Project, right-click the installation, and add a custom operation, such:

Select and click OK. Next, we need to transfer the input data in the installation process. In this project, right-click the newly added primary output, as shown in:

The CustomActionData in the property box specifies the custom data to be passed to the installer.

 

Then we can return to the newly created installation class. In the Install method, we can receive the database information output during the installation process, as shown below:

Public override void Install (IDictionary stateSaver) {base. install (stateSaver); string databaseServer = Context. parameters ["server"]. toString (); string userName = Context. parameters ["user"]. toString (); string userPass = Context. parameters ["pwd"]. toString (); string targetdir = Context. parameters ["targetdir"]. toString (); // here, you only need to execute the script for creating the database. // This is the database information File filled in by the user added to the installation directory. writeAllText (Path. combine (targetdir, "log.txt"), databaseServer + "/n/r" + userName + "/n/r" + userPass );}

Here, the server of Context. Parameters ["Server"] corresponds to the CustomActionData set above.

 

In this way, the installation package has been created. compile and generate the package, and test whether the installation package is valid.

The installation process is as follows:

There are so many installation processes.

Let's see if the installation is successful, for example:

This indicates that the web site has been successfully installed in the virtual directory.

. NET web project installation package Creation

Recently, the company requires that OA be installed to facilitate the installation of implementation personnel on the customer's machine.

I used vs2003 to package web projects several years ago, but I have forgotten it.

So the first idea is to use search engine search. There are many introductions on the Internet, but some of them are rough and I don't quite understand. It may be clear and clear to practice it.

 

Create a new Web installation project in the test web project, such:

 

In the newly created installation project, right-click the project, for example:

 

Select project output and select the project to be output, for example:

If I select a Web site, only the content output option is available. Select "OK" for the selected content file.

If you select a web project, such:

 

Right-click the project and click Properties, as shown in:

Click required again:

These components to be included in the package are mainly. NET Framework components. We need to package them in.

Here, we hook. NET Framework 2.0 (x86), and select the second option for the installation location of the required system components below, so that the components involved will be followed up with the installation package.

The first is to download components from the Microsoft website, and the third is to specify a custom location.

 

Click OK. Next, right-click the project, for example:

Click the start condition, for example:

We can see the startup conditions. Let's take a look at the IIS conditions, right-click the IIS conditions, and view the Properties window, such:

 

Here we can see the setting conditions. IISVERSION> = "#5" indicates that the IIS version must be later than 5.0. If the IIS version is later than 6.0, It is IISVERSION> = "#6 ".

 

Next we will set the installation interface. Right-click the project, for example:

Click the user interface, for example:

Here, I have added three steps: License Agreement, customer information, and text box (.

Right-click Start and click the Add dialog box, as shown in:

To select the required steps.

 

Right-click the license agreement step and view the attributes as follows:

We know that when installing a lot of software, there will be a license agreement, and then let's click agree, and then next, here.

We have added a license. rtf file to the installation project. You can select this file here.

 

Because the database needs to be set during the installation process, we also need to ask the installation user to enter the database server information during the installation process. Here is the step of text box (. Right-click the step to view the Properties window, as shown in:

There are four text boxes available here. We only need three database servers, accounts, and passwords, so the fourth Visible is set to false.

 

To configure the database, we need to create another project, create a class library project, and add an installation class, such:

Generate an installation class, for example, a class that inherits the Installer class.

 

Then we need to write code in the installation class.

We override the Install method:

public override void Install(IDictionary stateSaver)

Here we need to write the configuration database information.

 

Then we add this project to the installation project, for example:

Right-click the installation project, for example:

If you select a custom operation, the custom operation interface is displayed, as shown in the following figure:

Then, in the installation operation, add the newly created Project, right-click the installation, and add a custom operation, such:

Select and click OK. Next, we need to transfer the input data in the installation process. In this project, right-click the newly added primary output, as shown in:

The CustomActionData in the property box specifies the custom data to be passed to the installer.

 

Then we can return to the newly created installation class. In the Install method, we can receive the database information output during the installation process, as shown below:

Public override void Install (IDictionary stateSaver) {base. install (stateSaver); string databaseServer = Context. parameters ["server"]. toString (); string userName = Context. parameters ["user"]. toString (); string userPass = Context. parameters ["pwd"]. toString (); string targetdir = Context. parameters ["targetdir"]. toString (); // here, you only need to execute the script for creating the database. // This is the database information File filled in by the user added to the installation directory. writeAllText (Path. combine (targetdir, "log.txt"), databaseServer + "/n/r" + userName + "/n/r" + userPass );}

Here, the server of Context. Parameters ["Server"] corresponds to the CustomActionData set above.

 

In this way, the installation package has been created. compile and generate the package, and test whether the installation package is valid.

The installation process is as follows:

There are so many installation processes.

Let's see if the installation is successful, for example:

This indicates that the Web site has been successfully installed in the virtual directory.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.