How to make a project for creating installations for multiple applications
Consider a situation where you develop several applications and need to create an installation package for each program. It takes a lot of time to create a separate project for each application in the installer CreateInstall. Also, you have to edit each project if you want to make the same changes to the installation script in the future.
How to solve this problem? The CreateInstall installer has an excellent Multi Build feature for solving this problem. Let’s consider the possibility of Multi Build in a simple example. Suppose there are three applications: My Application, Super Application, Best Application. We are going to develop a project that can be used to create installations for all these applications.
Files of all applications are stored in c:\Applications\My Application, c:\Applications\Super Application and c:\Applications\Best Application. Executable files: myapp.exe, superapp.exe, bestapp.exe. We need to acquire the version from VERSION_INFO of these files automatically. The installation process will show the appropriate license file, extract the files to the appropriate directory and create a shortcut to the installed application. Also, the installation of Best Application displays a message during the installation.
Step 1. Create a simple project and go to Project - Preprocessor. You will see Multi Build list there. We have three applications with different application names and executable files. Therefore it is sufficient to add two variables appname, exename and fill in three columns.
Multi-build variables
Step 2. Go to the Project - Output page and define the name of the setup executable file as $exename$-setup.exe. The each application will have its own setup file. For example, the setup of My Application is myapp-setup.exe.
Open Project - Product Details and set the following parameters:
Program Name: $appname$ Version: C:\Applications\$appname$\$exename$.exe Application Name: $appname$
Step 3. Open the Script tab and specify the license file in the Dialog - License command as C:\Applications\$appname$\license.txt.
Now edit the Installation Files command. Insert c:\Applications\$appname$\*.* into Source Files and directories list.
CreateInstall will compress files from the appropriate directory. We also add a shortcut to the Shortcuts [List] command.
Shortcut Name: $appname$ Filename: $exename$.exe
Step 4. Our task is to display the message during the installation of Best Application. In principle, this step is added to explain how to exclude certain commands for different installations. Insert the Source Code command with the ifdef operator. If the condition is false, then the internal code is ignored when the script is being compiled.
ifdef "$exename$" == "bestapp" { $body$ }
Further, any command can be inserted into this Source Code. Step 5. We have successfully created the project. Now, how to create a setup for each application? If you press the Build Setup button, the installation of the first application My Application will be created.
Creation of installations with the installer CreateInstall
Select the Setup menu item and then Multi Build. You can create an installation for one application or build all setups.
Creating installations from CreateInstall
Creation of installations with the command prompt of the installer CreateInstall
As you know, you can create setups by using the command prompt of cicmd.exe. In this case, you must use the -m
cicmd.exe -m1 "c:\projects\multi-build-installer.ci"
To create an installation for Best Application
cicmd.exe -m3 "c:\projects\multi-build-installer.ci"
Download the example project multi-build-installer.ci