简体   繁体   English

如何从 Inno Setup Pascal Script 设置版本号

[英]How to set version number from Inno Setup Pascal Script

I have a script that reads the version number from an application file.我有一个从应用程序文件中读取版本号的脚本。 Now I need to find a way to place this number in the AppVersion directive of Inno Setup.现在我需要找到一种方法将这个数字放在 Inno Setup 的AppVersion指令中。

How can I place the return value of my function in the AppVersion directive?如何将函数的返回值放在AppVersion指令中?

Use a scripted constant :使用 脚本常量

[Setup]
AppVersion={code:GetAppVersion}
[Code]

function GetAppVersion(Param: string): string;
begin
  Result := MyFunction;
end;

If the function call is costly, you should cache its value to a global variable and use the cached value in the scripted constant.如果函数调用代价高昂,则应将其值缓存到全局变量中,并在脚本常量中使用缓存值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM