Pre-compiler to implement the same project and compile different versions

Source: Internet
Author: User

Sometimes we encounter such a situation where a software is divided into several versions. In fact, most of the content is the same, but there are slight differences between several files. Therefore, we hope to compile different versions in the same project by setting certain conditions.

Implementation Engineering: installscript 2009/2010

Implementation:

1. Define feature that meets different version requirements

For example, two feature versions can be created in China and abroad. One is named foroversea and the other is fordomestic. Then, slightly different files can be added to different feature versions. note: It is best to set the visible attribute of these two feature to "no", because these feature are only different for us and customers do not need to know

2. Which feature does the script install?

In function onfirstuibefore (), specify certain conditions and use the componentselectitem function to implement which feature to install under what conditions:

# Ifdef foroversea

Componentselectitem (media, "fordomestic", false );

# Else

Componentselectitem (media, "foroversea", false );

# Endif

3. Specify the version to compile

Find the settings option in the build menu, select the "compile/Link" tab, and enter the version to be compiled in Preprocessor. For example, if you need to compile a foreign version, enter foroversea (note: the foroversea entered here must be the same as that defined in script # def in step 1.

4. Select refresh build in the build menu to compile the desired version.

5. For is6.3, steps 2nd are slightly different,

1) You must first define global define # define fordomestic 0 // 0: fordomestic; 1: foroversea

2) # If (fordomestic = 0)

Componentselectitem (media, "foroversea", false );

# Elif (fordomestic = 1)

Componentselectitem (media, "fordomestic", false );

# Endif

 

 

Copyright statement: Indicate the original source for reprinting.

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.