Incrementing build number every time the script is compiled

From ISXKB

(Difference between revisions)
Jump to: navigation, search
(Introduction: The word 'ISPP' added that a search for it can be successful)
(modified link to download old ISXKB)
Line 1: Line 1:
-
This article is more or less a takeover from the [http://www.vincenzo.net/isxkb/images/5/57/Isxkbchm.zip old ISXKB].
+
This article is more or less a takeover from the [[Media:isxkbchm.zip|old ISXKB 339KB]].
== Introduction ==
== Introduction ==

Revision as of 14:07, 20 August 2007

This article is more or less a takeover from the old ISXKB 339KB.

Introduction

Inno Setup's preprocessor (ISPP) can store a new build number in an ini file every time the script is compiled. This build number can then be used for certain tasks, for instance to change the output file name.

Implementation

Add the following few lines to the top of your script. When beeing called will create a file BuildInfo.ini to the script's directory.

; Read the previuos build number. If there is none take 0 instead.
#define BuildNum Int(ReadIni(SourcePath	+ "\\BuildInfo.ini","Info","Build","0"))

; Increment the build number by one.
#expr BuildNum = BuildNum + 1

; Store the number in the ini file for the next build
#expr WriteIni(SourcePath + "\\BuildInfo.ini","Info","Build", BuildNum)

Example

This shows how the obtained build number is used to create a new output file containing the number every time the script is beeing compiled.

[Setup]
OutputBaseFilename=Setup_{#BuildNum}

It creates files called 'Setup_1.exe', 'Setup_2.exe', 'Setup_3.exe', etc.

Personal tools
Ads: