Inno Setup - 根据文件版本中止编译
Inno Setup - Abort compile based on file version
我想在 Inno Setup 中添加一个检查,以确保我的 exe 文件版本始终与安装程序的版本相匹配。有没有办法通过预处理器做到这一点?
所以我的想法是,如果 exe 版本与我在 Inno Setup 中设置的版本不匹配,它将中止编译。
定义您的版本并使用 GetFileVersion() 预处理器命令将 .exe 文件与它进行比较:
#define Version "1.5.0.0"
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
OutputDir=userdocs:Inno Setup Examples Output
[Files]
Source: "MyProg.exe"; DestDir: "{app}"
#if (GetFileVersion("MyProg.exe") != Version)
#error File version does not match!
#endif
“#error”停止编译并显示消息。
这是从 Inno Setup Examples 目录修改的Example1.iss。
我想在 Inno Setup 中添加一个检查,以确保我的 exe 文件版本始终与安装程序的版本相匹配。有没有办法通过预处理器做到这一点?
所以我的想法是,如果 exe 版本与我在 Inno Setup 中设置的版本不匹配,它将中止编译。
定义您的版本并使用 GetFileVersion() 预处理器命令将 .exe 文件与它进行比较:
#define Version "1.5.0.0"
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
OutputDir=userdocs:Inno Setup Examples Output
[Files]
Source: "MyProg.exe"; DestDir: "{app}"
#if (GetFileVersion("MyProg.exe") != Version)
#error File version does not match!
#endif
“#error”停止编译并显示消息。
这是从 Inno Setup Examples 目录修改的Example1.iss。