I'm using InnoSetup 6 (Windows 10, Visual Studio Code and WSL as my shell) to create an installer. This ISCC compiler is called from from an automated script. That script is in charge of setting environment variables holding the generated installer version and generated installer name. Both of them are intented to be used for the InnoSetup installer compiler (iscc.exe
) called by the script.
I'm using envvars because I do not want to mess my ISS file with hard-wired versions numbers.
I thought using environment variables was possible in Innosetup, as per this question here on StackOverflow (Can one use environment variables in Inno Setup scripts?).
Unfortunately, Innosetup complains with "The [Setup] section must include an AppVersion or AppVerName directive."
. Like if the GetEnv()
yield an empty string.
I tried calling ISCC from the command line manually like this :
export JFROG_DEFAULTGROUPS_VERSION=1.0.0-1 && [path..]\iscc.exe myiss.iss
Or even exporting the environment variable using export
:
export JFROG_DEFAULTGROUPS_VERSION=1.0.0-1
, then checking the environment variable was actually set and starting the compiler : env [path..]\iscc.exe myiss.iss
In this case, env
yield the following :
JFROG_DEFAULTGROUPS_VERSION=1.0.0-1
SHELL=/bin/bash
PATH=[...]
[...]
This makes me think the environment is set, as per my shell (WSL). But both didn't give any better result.
My ISS file is as follow :
#define MyInstName "MyApp"
#define MyInstVersion GetEnv("JFROG_DEFAULTGROUPS_VERSION")
[Setup]
AppName={#MyInstName}
AppVersion={#MyInstVersion}
DefaultGroupName={#MyInstName}
OutputBaseFilename=MyApp_{#MyInstVersion}_setup
AppendDefaultDirName=no
DefaultDirName={commonpf}
[Components]
Name: default_groups_conf; Description: Default Groups Configuration; Types: full
[Run]
[Code]
function InitializeSetup(): Boolean;
begin
if not ('{#MyInstVersion}' = '') then begin
MsgBox('MyInstVersion Env Var not set.', mbInformation, MB_OK);
Abort;
end;
end;
What is wrong with this ? How to properly catch environment variables in [Setup] and [Code] sections ?