Notes for Using InstallShield for the first time)

Source: Internet
Author: User
ArticleDirectory
    • The requirements are as follows:
    • Tool Selection
    • Procedure

The company's products need to be packaged and released. They have never been packaged before. The packaging method is handed over to me.

The following content is the notes I wrote after my research. If you are not familiar with it, there may be errors or stupid methods. I hope you can correct them and appreciate them.

I don't know what it means or what it means. It is enough for me to do so.

The requirements are as follows:

Project inclusion masterProgramAnd the database file, you can choose to install these two parts in different places

After all the files are copied, write the installation path of the database files into an INI file under the installation directory of the program.

Tool Selection

1. The package tool provided by vs05

This tool was selected at the beginning, but I did not know how to make it meet our needs.

2. InstallShield 2009 pro

Then I thought of the professional packaging tool is and downloaded a newer version for trial use. However, there are few online tutorials and the software is powerful, so I am exploring it slowly.

Step 1. Start

For a general package project on the internet, select the basic MSI project. to customize the interface, select the installscript MSI project.

 

Because I only need to package and have executed some scripts, I chose the basic MSI project. Enter the project name, select location, and click OK to create a new project.

On the page, we can select two packaging methods (in the red box)

1. Project Assistant can perform simple configuration similar to the wizard class for packaging. If this method is selected, the tools provided by Visual Studio can also be easily implemented.

2. The installation designer has the highest degree of self-customization with completely free configurations.

Depending on your needs, I naturally choose the second method.

2. Configuration

Click installation designer to go to the following page:

Select the configuration area in the red box.

 

2.1 General information

Select general information in installation information, and configure the basic information of the software here.

You can write your name on the red line. You are the author of this project.

You can select the installation language for the following setup packages eages. I only consider Simplified Chinese, so the settings are not changed.

Enter your company name and website in the red box. I will write the two in the example.

 

Enter the software information, software name, and version in product properties.

Installdir refers to the installation directory. The configuration method in the figure defaults to c: \ Program Files \ transformers \ demo.

 

2.2 files

The area on the right is divided into four parts. The above two are local computing machines, and the following two are target computers.

The general idea is the same as that of resource management. Here you can customize it based on your own ideas.

Let me give you a column and pack it for whatever you want.

Expand the tree in destination computer's folders and select demo [installdir]. If you don't understand it, you need to learn the basic knowledge.

Drag some files from source computer's files (Local Computer) to destination computer's files. The following prompt is displayed:

You need to create a feature. I don't know what it is. I understand it as a collection of files. Enter the name. I entered main and click OK.

(If you don't see anything in the red box on the left, right-click any node in the tree structure and select Show components)

After you add the package you want to package, a basic package is ready. You can compile and execute the package and try to install it.

The icon compilation and execution on the toolbar are the same as those in VC ++ 6.0. The third red circle is uninstallation.

 

Of course, this step alone cannot meet my needs. I also need to add a database folder and right-click on demo [installdir] -- select new folder -- name it database

Perform graph operations

Click Next, and proceed to step 2, as shown in the figure.

Next, add the database-related files. Of course, you can add a file (folder) first, and add the remaining files in "files and folders.

At this point, the database file is added to the installation package. However, in the default installation process, only the installation path of the main program is selected and the database path is not selected. Therefore, you need to manually add it.

For the method, see 2.3.

 

2.3 Sequences

Everyone should have installed the software, and the person who is the best knows how to install the program by clicking "Next. This section describes how to customize the installation sequence, that is, the jump from "previous" to "Next.

Select Custom Actions and sequences on the left and operate in the middle tree. Right-click the user interface and Choose Insert...

Click OK, and a databasefolder is added to the sequences tree. You can drag it to the desired position.

Of course, sequences is not so easy to edit. It seems that it cannot be implemented by dragging. You need to edit each form.

In the figure, it means that in the dialog box that selects the databasefolder path, clicking the "previous" button will jump to the customerinformation dialog box.

This is the editing method, and the workload is not small, or there are other simple methods, but I don't know

 

2.4 modify XML or INI files dynamically

In this project, I need to write the installation path of the project in an INI file under the installation directory. This INI file needs to be packaged in the project.

First, make sure that the INI file has been added to the packaging project.

Create a new INI file named "My. ini" in ini file changes.

Create the section to be rewritten under the my. ini file (in my example, installdir) and keyword (in this example, DIR), and edit keword

Write the system variable [installdir] in data value, which indicates the installation directory of the program. If you want to obtain the database installation directory, you can write it to [databasedir]

The XML modification is similar to this one. I believe it can be integrated.

I encountered a problem in my actual project.

My. INI is what MySQL uses. It is stored in the database directory. You can simply add and modify the installation method.

However, the path required by MySQL is similar to C:/mydatabase/MySQL/

The Path obtained through [databasedir] above is Windows Standard C: \ mydatabase \ mysql \

Therefore, I have to reverse this slash. I don't know how to reverse it. Only know that it may be modified through the script(If anyone knows how to do this, please advise)

For the script, see 2.5.

 

2.5 installscript

I just got in touch with it. I don't even know where to write the script. I don't know how to write the script, even though I don't write it now ~~(For advice)

Although I still can't write a script, I still want to write the script where I am and how to run it first. I hope my friends who have the same problems will see it.

Then

The editing area on the right is used to write scripts. It's hard to understand if you have programming experience.

Return to custom actions and sequences for script execution, right-click custom actions in the middle list, and select Custom Actions wizard

Select Run installscript code in action type, select when to execute the install execute sequence in insert into sequence, and follow the wizard prompts for other operations.

# Include "ifx. H "Export prototype processafterdatamove (hwnd); export prototype string replacestr (string); export prototype runbat (string); function processafterdatamove (hmsi) string p_dir, db_dir; // p_dir is the path of the INI file under the main program directory, and db_dir is the database path begin p_dir = targetdir + "temp. ini "; // targetdir is the system variable volume. The installation path is stored. // The getprofstring () function is a system function, used to read information in the INI file // The first parameter specifies the file path // The second parameter specifies the section name // The third parameter specifies the keyword name // The last parameter is used to return The value of the specified keyword. Note: Yes! Getprofstring (p_dir, "Temp", "dir", db_dir); // The replaceprofstring () function is a system function, used to modify the keyword value in the INI file // The first parameter specifies the path of the file // The second parameter specifies the section name // The third parameter specifies the keyword name // The fourth parameter specifies the original keyword Value // The Fifth parameter specifies the new value of keyword // only when the first four conditions match completely, replaceprofstring (db_dir + "My. ini "," mysqld "," basedir "," \ "" + db_dir + "\" "," \ "" + replacestr (db_dir) + "\""); replaceprofstring (db_dir + "My. ini "," mysqld "," datadir "," \ "" + db_dir + "data \", "\" "+ replacestr (db_dir +" data ") + "\" "); // execute batch processing runbat (db_dir); end; function string replacestr (STR) List strlist; string temp, path; begin // create a list to store tokens strlist = listcreate (stringlist); // break down the token into list strgettokens (strlist, STR ,"\\"); // retrieve the tokenlist header node listgetfirststring (strlist, temp); // Add "/" Path = temp + "/" to the header node "/"; // cyclically retrieve all nodes and add "/" while (listgetnextstring (strlist, temp) = 0) Path = path + temp + "/"; endwhile; return path; end; function runbat (db_dir) // execute batch processing string dir; begin dir = db_dir + "bin \ exec. bat "; // call other programs // The first parameter is the location of the calling program // The second parameter is the parameter required to call the program to run the program // wait indicates that the program will be executed after completion, install and continue with launchappandwait (Dir, "", wait); end;

from: http://www.cnblogs.com/da2jie/archive/2009/11/04/1594345.html

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.