Split a very long string parameter into multiple lines in Inno Setup script

Viewed 199

I have a very long string with file excludes in my Inno Setup script:

[Files]
Source: "..\bin\x64\Release\*"; \
    Excludes: ".editorconfig,PackageContents.xml,\runtimes\win-arm\*,\runtimes\win-x86\*,System.Buffers.dll,System.Memory.dll,System.Numerics.Vectors.dll,System.Runtime.CompilerServices.Unsafe.dll"; \
    DestDir: "{app}\Contents"; \
    Flags: ignoreversion recursesubdirs createallsubdirs

I would like to split that for better readability, for example:

[Files]
Source: "..\bin\x64\Release\*"; \
    Excludes: ".editorconfig," + \
              "PackageContents.xml," + \
              "\runtimes\win-arm\*," + \
              "\runtimes\win-x86\*," + \
              "System.Buffers.dll," + \
              "System.Memory.dll," + \
              "System.Numerics.Vectors.dll," + \
              "System.Runtime.CompilerServices.Unsafe.dll"; \
    DestDir: "{app}\Contents"; \
    Flags: ignoreversion recursesubdirs createallsubdirs

Is that somehow possible?

Thanks in advance!

1 Answers

You can define a preprocessor variable using multi-line expression and then use the variable in the (Excludes) parameter:

[Files]

#define Excludes \
    ".editorconfig," + \
    "PackageContents.xml," + \
    "\runtimes\win-arm\*," + \
    "\runtimes\win-x86\*," + \
    "System.Buffers.dll," + \
    "System.Memory.dll," + \
    "System.Numerics.Vectors.dll," + \
    "System.Runtime.CompilerServices.Unsafe.dll"

Source: "..\bin\x64\Release\*"; \
    Excludes: "{#Excludes}"; \
    DestDir: "{app}\Contents"; \
    Flags: ignoreversion recursesubdirs createallsubdirs
Related