Search code examples
parameter-passinginno-setup

ISCC - /D compiler-parameter seems to have no effect


I'm trying to use the /D parameter of the Inno Setup Command Line Compiler to choose which files should be included in my setup.

The code looks like the following:

#define MyAppName "MyApp"
#define MyAppVersion "1.0.0"
(....)
#define PHASE

[Setup]
AppVersion={#MyAppVersion}
(....)

[Files]
Source: "C:\temp\myfile.txt"; DestDir: "{app}";

#if PHASE == "test"
    Source: "C:\temp\onlyInTestBuildNeeded.txt"; DestDir: "{app}";
#endif

I try to compile the script ISCC /DPHASE=test "D:\foo\bar.iss" but it seems to have no effect on my PHASE define.

So can anyone explain me what I'm doing wrong? I can't find any more information at the Inno Setup Help.


Solution

  • You overwrite PHASE in the .iss file with the line

    #define PHASE
    

    Delete that line or check it with #ifdef in order to define it only when it is not set via command line /D switch:

    #ifndef PHASE
      #define PHASE
    #endif