) Use Visual Studio to create the installation package

Source: Internet
Author: User

 

Address: http://www.cnblogs.com/HopeGi/archive/2013/06/05/3118270.html

 

During a summer vacation of a certain year, I would like to share the well-written "" game with Feng boy, but at that time I would not do an automatic installation. the installation package of net framework4.0 cannot be shared with her.

Recently, I started a task. Let me create a package for the team's results, and the SQL Server and ,. net Framework must be installed with one click, and the databases and ports used by the project must be installed together. This is the end of the process.

 

Installation Project Introduction

Create an installation package project

After the project is created, the file system editor is displayed.

There are other types of editors.

From left to right: File System Editor, Registry Editor, file type editor, User Interface Editor, custom operation editor, and start condition editor.

So far, only three editors have been used.

    • File System Editor: After editing and installing each file on the target computer, as shown in the figure aboveProgramThe folder is stuffed with everything in the program; the "user's 'project' menu" is the content in the Start Menu, where there is usually a program shortcut, uninstall the program; "User desktop" is something on top of the desktop, and there is usually a program shortcut. If it is special, it is like a cool dog to get a folder.
    • User Interface Editor: This is used to edit the interface popped up during installation. You can change the order in which the dialog box appears. If necessary, you can add other dialogs, for example, enter the database instance name, IP address, and port number.

    • Custom operation Editor: You need to perform other operations during the installation process, such as attaching a database or copying files. For custom operations, you need to add another project, a class library project. The key is that an installer class is required in the class library.

 

Installation Package Creation

After the various editors are introduced, the installation package is created.

 

Open the file system Editor, right-click the application folder-add-file, and select the files (including EXE and DLL) to be installed on the target computer in the displayed dialog box)

In a similar way, you can add content in the user's program menu and user desktop. The simplest way is to add shortcuts.

If you want to perform some operations (copy some files, open ports, attach databases, etc.) during the installation process, you need to write the installation program class. In the installer1 class mentioned above

You can rewrite some methods to select the appropriate method based on different conditions. Here, the onbeforeinstall method is used.

 
Protected Override VoidOnbeforeinstall (idictionary savedstate ){//Parameters obtained from the user interfaceStringPortid = context. Parameters ["Portid"];Base. Onbeforeinstall (savedstate );//A custom method to open a port using the command lineOpenport (portid );}

 

After the installer class is defined, return to the file system editor to add a project output.

Select the project where the installation class is located.

Go to "Custom operation Editor", right-click the installed node, and choose "add custom operation". In the displayed dialog box, select the added primary output *****

The open port above requires a port number, which is passed in from the user interface. In the "User Interface Editor", right-click the Start Node and choose "add". In the displayed dialog box, select the appropriate type.

Only the text box (a) is enough.

Edit the content of this dialog box. You can edit it in the Properties window.

Here are the attributes starting with bannerbitmap, bannertext, bodytext, and four groups of Edit. I believe this graph shows the meaning of each attribute, and eidtvisible controls whether the text box is displayed.

Here, you only need to display eidt1, and set each attribute to this

Return to the custom operation to edit and open the attribute window of the main output ***, and attach this value to the customactiondata attribute.

/Portid = "[portid]"

Before the equal sign is the context of the installer class. parameters ["portid"]; parameter name, followed by portid is the value of the editporert attribute on the user interface. If there are multiple parameters, separate them with spaces, for example:

/Para1 = "[para1]"/para2 = "[para2]"

The entire installation process is roughly completed. Finally, it is necessary to have necessary components when the program is running, for example (.. NET Framework), right-click the installation project, open the Properties window, click required, and select required components.

Here is an episode. If SQL Server 2005 Express is selected here and an error is reported during generation, I try to use it in the installation program class.CodeOne-click installation of SQL Server is called, but it fails because the system only allows one instraller to run. In the end, you must check SQL Server 2005 Express. For the solution, you must refer to another blog post "user-defined system essentials".

 

Right-click the installation project to generate the installation package.

Setup.exe is the installation program for one-click installation of components. The installation program with the MSI suffix skips the installation program for component installation. The installation package is complete. If I knew this during that summer vacation, I would be able to analyze my little games with Feng boy. Sorry!

My thoughts in this article are a bit messy. Please give me more advice. Thank you!

Related Article

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.