我正在使用Inno Setup生成我的应用程序的安装程序。如何设置Inno生成的setup.exe(VersionInfoVersion
)的版本号使其与我的应用程序的版本号自动匹配?现在,每次我部署应用程序的新版本时,都需要手动更新版本号。
现在我正在这样做:
[Setup]
VersionInfoVersion=1.2.2.0 //writing the value manually
我想要这样的东西:
[Setup]
VersionInfoVersion={Get the version of my app}
您可以像这样使用Inno Setup Preprocessor GetFileVersion
函数
#define ApplicationName 'Application Name'
#define ApplicationVersion GetFileVersion('Application.exe')
[Setup]
AppName={#ApplicationName}
AppVerName={#ApplicationName} {#ApplicationVersion}
VersionInfoVersion={#ApplicationVersion}
使用a command line argument的另一种方法:
[Setup]
AppVersion={#MyAppVersion}
您只需按照以下命令从cmd调用脚本:
cd C:\Program Files (x86)\Inno Setup 5
iscc /dMyAppVersion="10.0.0.1" "C:\MyPath\MyScript.iss"
它在iss脚本中模拟#define MyAppVersion="10.0.0.1"
。
如果使用CakeBuild,则可以将此参数作为]传递>
string CurrentVersion = "10.0.0.1";
InnoSetupSettings settings = new InnoSetupSettings();
settings.Defines= new Dictionary<string, string>
{
{ "MyAppVersion", CurrentVersion },
};
InnoSetup("C:\MyPath\MyScript.iss", settings);
[如果您使用的是纯粹的Webinstaller,则无法接受的解决方案,因为您根本没有application.exe来获取版本号。
我在使其正常工作时遇到了一些问题,因此请提供我的解决方案。
经过一段时间的尝试其他方法后,它对我有用的方法是使用相对路径(我在文件夹中有.iss文件,而在上面两层中有EXE文件)。