Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create multiple setup applications with one .iss config?

Tags:

inno-setup


Is it possible for one .iss file to produce different setup exes at the same time? maybe with multiple [Setup] sections?

like image 921
Greg Avatar asked Feb 20 '23 14:02

Greg


2 Answers

It is not possible to create more than one output setup exe at the same time, but it is possible to create more than one from a single script.

The key is to use ISPP's #define and #ifdef or #if directives to designate parts of your script which are only compiled if specific variables are defined or given a particular value. You can then use a batch script to invoke iscc with the /dVAR or /dVAR="VALUE" parameters (which are the equivalent of a #define) to select different conditions for each compile.

This is only really useful if the scripts are largely the same, however (eg. if you want to make separate installers for different "editions" of an application, instead of including all files for the largest edition and deciding at runtime which to install). If your scripts are completely different from each other, then you should just create separate scripts and compile them from a batch file or an automated build script.

like image 175
Miral Avatar answered Mar 07 '23 13:03

Miral


Test result:

By running a simple test... No, this is not possible. At first you can introduce sections on several places in a script. Consider you can do the following in your script:

[Setup]
AppName=My Program 1
AppVersion=1.5

[Files]
Source: "MyProg.exe"; DestDir: "{app}"

[Setup]
DefaultDirName={pf}\My Program

From that you can see that compiler wouldn't recognize which one of the [Setup] sections belongs to which setup if you could write the script for more of them in one script file.

Workaround:

However, if you need to automate the build process on a basic level, you can create a batch file and run the compiler through the command line for all of your scripts. See the reference about command line compiler usage.

If you will compile several scripts with the same output directory, don't forget to specify different value of the OutputBaseFilename directive (the output exe name) for each script file.

like image 21
TLama Avatar answered Mar 07 '23 15:03

TLama