inno-setupinno-setup-v6

Inno Setup shows "Failed to open included file" error message after compilation if include file is deleted after include


I need to (trust me on that) make use of a tool that generates a file list which is included in the installer.

The file with the generated list of files is deleted right after the include. When compiling the script, Inno Setup includes the file list, but shows an orange warning message

Failed to open included file: Cannot open file "D:\foo\TempFileList.txt". The system can not find the file

To reproduce: Place a file TempFileList.txt containing eg

Source: "D:\foo\test.DE"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\foo\test.ES"; DestDir: "{app}"; Flags: ignoreversion

alongside the Inno Setup script, which reads:

[Setup]
AppName=InnoTest
AppVerName=InnoTest
DefaultDirName={commonpf}\InnoTest

[Files]
#define TempFile SourcePath+'TempFileList.txt'
#include TempFile
#expr DeleteFile(TempFile)

When compiling you'll see the orange warning message.

Why does Inno Setup want to open the file list anyway, after it has been processed?

Thanks!


Solution

  • It comes from the "new" Inno Setup 6.1 IDE feature:

    The Compiler IDE now automatically opens (up to 10) #include files in tabs which allow you to edit and debug these files from within the Compiler IDE. The list of #include files is updated after opening a new main file and after each compilation. This can be turned off in the options.


    So it's harmless IDE-only thing. If you compile on command-line, it won't happen.

    If you want to disable the feature anyway, go to Tools > Options > Miscellaneous > Automatically open #include files.