I'm working with an Inno Setup .iss file to create an installer for a .NET project.
I want to default the installer build to use the Debug build output paths so devs can create local installer for testing, but I want to be able to pass a parameter to the Inno compiler to tell it to use the Release output paths instead when doing a proper production build.
From what I can gather I can't add a custom variable to the [Setup]
section, because I tried
[Setup]
Config = {param:config|Debug}
as described in Is it possible to accept custom command line parameters with Inno Setup, but I get
Unrecognized [Setup] section directive "Config"
So it appears to me that the only option is to have something in the #define
section.
I see that it's possible to define parameters at the command line with /Dparamname=value
.
So I tried the {param:Config|Debug}
and {param:#Config|Debug}
as suggested in Inno Setup - Conditional Parameters, but again I get compiler errors:
Unknown filename prefix "..\project\bin\{param:"
And if I #define Config "Debug"
in the iss file then passing /DConfig=Release
at the command line doesn't override the Debug value.
So is there any neat way to do what I want, where I can run the compile with a default value if nothing is passed into the command line, and use the command line value if it's available?
Or is there an altogether easier way to do this that I'm missing.
Currently my command line call looks like this:
iscc path\to\my\iss\file /DConfig=Release
I'm using Inno Setup 5.5.9.
Use the #ifndef
:
#ifndef Config
#define Config "Debug"
#endif
Note the difference between compile-time and run/install-time parameters. This is about compile-time parameters. While the first question you have referred to is about run/install-time parameters.