Inno Setup安装文件名附加AppVersion

2024-04-14

如何追加AppVersion to setup.exe file?

换句话说,如何使输出文件名为sample-setup-1.4.2.0.exe?

[Setup]
AppName= {#GetStringFileInfo("Sample.exe", "ProductName")}
AppVersion= {#GetStringFileInfo("Sample.exe", "FileVersion")}

OutputBaseFilename=setup

两个宝贵的教训是:

  1. Lesson 1 https://stackoverflow.com/questions/49361199/using-getstringfileinfo-in-setup-section-of-inno-setup:内联函数应用作{#FunctionName(...)}
  2. Lesson 2 https://stackoverflow.com/questions/12728572/how-to-create-a-destname-which-includes-date-and-time-at-installation-in-inno-se: 变量在[Setup]字段通过使用调用SetupSetting功能。

有了以上信息,我们就可以做出sample-setup-1.0.0.0如下;

OutputBaseFilename=sample-setup-{#SetupSetting("AppVersion")}

同样,我们可以附加日期时间;

OutputBaseFilename=sample-setup-{#SetupSetting("AppVersion") + GetDateTimeString('dd-mm-yyyy hh-nn-ss', '-', ':')}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Inno Setup安装文件名附加AppVersion 的相关文章

随机推荐