在 Inno Setup 脚本中将一个很长的字符串参数拆分为多行

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

我的 Inno Setup 脚本中有一个很长的文件排除字符串:

[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

为了更好的可读性,我想拆分它,例如:

[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

这有可能吗?

提前致谢!

您可以使用多行表达式定义预处理器变量,然后在 (Excludes) 参数中使用该变量:

[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