We have recently added another two new conditions – VarEquals and NotVarEquals – which operate alongside the If command and work to determine different actions to take depending on the return value of the condition. As with all commands and conditions in Pipeline Runner what they do should be pretty much self explanatory just from their names, but why did we add them?

One of our larger users had wanted to automatically update their version numbering depending on the state of Task Exclusions, so we added HasTaskExclusions and NotHasTaskExclusions to vary the automatic updating. Result: a customer even more delighted than they were before!

However, once they started using it they realised that they had not thought about the situation where they need to change the version number values to a fixed value rather than an existing or automatically incremented value. For example, going from 1.0.123.123 to 2.0.0.0 was not possible in a script that was using automatic incrementation. To solve this problem, the VarEquals condition is used.

If the initial version variable values are assigned in the Setup section, you can assign a known value – the obvious one would be ‘Auto’ since it makes perfect sense when you want to determine whether or not to do something automatically – and only auto increment if that value is set. For the situation where you need a major version upgrade and do not want to auto increment but instead assign a value, you can simply assign the value to 0 instead of Auto for that one build and then change it back afterwards. If you follow our recommendations and assign the variable values  that are likely to change at the very top of the project script, that will be simple.

Using Pipeline Runner it was easy to solve their problem despite the complex calculations involved, as you can see from this similar script example:


[Setup]

; Change the target file name and path to that of your application executable
Var:VersionTargetFile=“C:\Source\MyApp\bin\Release\MyApp.exe”

; Now declare other global variables here
Var
:Version,GetFileVersion,%%VersionTargetFile%%

Var:Major=1
Var
:Minor=0
Var
:Build=Auto
Var
:Revision=Auto

; Incremented version values are initially set to the current version
; Values will be updated by the UpdateVersionNumber task if it is allowed to run
Var
:NewVersion,%%Version%%
Var:NewFileNameVersion=GetFileNameVersion,%%VersionTargetFile%%
Var
:NewMajor=%%Major%%
Var
:NewMinor=%%Minor%% Var:NewBuild=%%Build%%
Var
:NewRevision=%%Revision%%

; MUST be done BEFORE the build!!
[Update Version Number]

Remark
:“Current Version: %%Version%%
Var
:IncrementedBuild=IncrementBuildFileVersion,%%VersionTargetFile%%
Remark
:“IncrementedBuild: %%IncrementedBuild%%
Var
:IncrementedRevision = IncrementRevisionFileVersion,%%VersionTargetFile%%
Remark
:“IncrementedRevision: %%IncrementedRevision%%

@If:VarEquals,NewBuild,“Auto”,
Assign:NewBuild,%%IncrementedBuild%%;
@If:HasTaskExclusions||VarEquals,NewRevision,Auto,
    Assign:NewRevision,%%IncrementedRevision%%;

Remark:“New Build: %%NewBuild%%
Remark
:“New Revision: %%NewRevision%%

If:NotHasTaskExclusions,Assign:NewRevision,0
Remark
:“New Revision: %%NewRevision%%

Assign:NewVersion,%%NewMajor%%.%%NewMinor%%.%%NewBuild%%.%%NewRevision%%
Assign
:NewFileNameVersion,%%NewMajor%%_%%NewMinor%%_%%NewBuild%%_%%NewRevision%%

Remark:“New Version: %%NewVersion%%
Remark
:“New File Name Version: %%NewFileNameVersion%%

; Remarks show in the report or the command prompt so you can see that it has worked correctly
; Rest of the script goes here


If that looks complicated to you, don’t worry because you don’t even need to type any of it! Pipeline Runner Studio will let you generate the whole thing by simply selecting the necessary parts from a menu or drop down button and it will build it automatically for you…

Pipeline Runner can make short work of even the most complicated requirements and provide complete automation of complex processes with ease. Once a project script is written, you can run it forever either automatically or on demand saving countless hours and removing all the risk of human error that comes with doing it manually.

Responsive site designed and developed by