cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
RodneyM
Level 4

Any way to auto increment the Version Number

This seams like it would be something so basic that everyone would want but I don't see it anywhere. When I build a new release I want it to automatically increment up the minor version number in case I forget to do it just like VB 6.0 does.

Does anyone know of an Installshield Plug-in or anything that does this or am I missing something here?
Labels (1)
0 Kudos
(4) Replies
RobertDickau
Flexera Alumni

You can use the Automation interface to modify the version number before performing a build; please see, for example, this ancient newsletter tip: http://www.installshield.com/news/newsletter/archives/0104_ipwi-automation.asp. You'll need to update the ProgID you use in CreateObject, but the idea is the same.
0 Kudos
osumatt
Level 3

Seems like something that you'd think Installshield would let you pass in through a command line parameter, doesn't it? Unfortunately, it doesn't. We created a vbscript file to do this.

Paste this into a vbs file (we call InstallShieldVersioner2008.vbs):

----------------------------------------------------------------
If Wscript.Arguments.Count < 2 Then
Wscript.Echo "InstallShield Product Version Update Utility " & _
vbNewLine & "1st argument is the full path to the .ism file" & _
vbNewLine & "2nd argument is the version number"
Wscript.Quit 1
End If

' Create the end-user automation object
Dim ISWIProject
Set ISWIProject = CreateObject("ISWiAuto14.ISWiProject"): CheckError

' Open the project specified at the command line
ISWIProject.OpenProject Wscript.Arguments(0) : CheckError
ISWIProject.ProductVersion = Wscript.Arguments(1) : CheckError
ISWIProject.ProductCode = ISWIProject.GenerateGUID : CheckError
ISWIProject.SaveProject: CheckError
ISWIProject.CloseProject: CheckError

Set ISWIProject = Nothing

Sub CheckError()
If Err = 0 Then Exit Sub
Dim message
message = Err.Source & " " & Hex(Err) & ": " & Err.Description
Wscript.Echo message
Wscript.Quit 2
End Sub

----------------------------------------------------------------




And we have multiple vbscript files that call the above file. These files look like so:




----------------------------------------------------------------

Option Explicit

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'edit the following entries
const INSTALL_VERSION_SP = "1.1.500"
const INSTALL_FILE = "D:\Build\Source\MyProduct.ism"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

const INSTALLSHLD_PATH = "C:\Program Files\Macrovision\IS2008\System"
const INSTALL_VERSIONER = "D:\build\buildmachine\InstallShieldVersioner2008.vbs"

'call Main subroutine
Call Main()

Sub Main()

Dim objShell, CmdLine

Set objShell = WScript.CreateObject("WScript.Shell")

CmdLine = objShell.Run("cmd /C c: && """ & INSTALL_VERSIONER & """ """ & INSTALL_FILE & """ """ & INSTALL_VERSION_SP & """" , 5, true)
If (CmdLine <> 0 and CmdLine <> 2) Then
WScript.Echo "Error occurred executing Versioner against project " & INSTALL_FILE
WScript.Quit(-1)
End If

...

End Sub

----------------------------------------------------------------

Good luck!

Matt
0 Kudos
RobertDickau
Flexera Alumni

In InstallShield 2008, IsCmdBld apparently has a new -y switch you can use to pass in a version for a particular build; auto-incrementing the version is the somewhat tricky part...
0 Kudos
Christopher_Pai
Level 16

And if your using MSBuild you just set the $(InstallShieldProductVersion) and it'll pass it to the build enginer for you.

So easy, thank you MichaelU!
0 Kudos