View Full Version : Setting ProductVersion from command line build

01-08-2003, 06:24 PM
There were a few questions whether this was possible. I replied saying "No" because it's an Msi property. There is a workaround for this where you can set the ProductVersion through a VBScript instead of from the builder itself. It's basically a straight forward SQL operation that changes a value in a table. At least this approach will let you automate the process. You can run this script against the .ise file and then build, or run this script against the msi once it is built. Note that you should change values marked in red to correspond to the location of the file and the version number you want to specify.

Dim pInstaller
Set pInstaller = CreateObject("WindowsInstaller.Installer")

Dim pDatabase
Set pDatabase = pInstaller.OpenDatabase("C:\Test.msi" , 2)

pSQL1 = "SELECT `Value` FROM `Property` WHERE `Property` = 'ProductVersion'"

Dim pView1

Set pView1 = pDatabase.OpenView(pSQL1)

Dim pRecord1
Set pRecord1 = pView1.Fetch

If (Not pRecord1 Is Nothing) Then
pRecord1.StringData(1) = "3.54.0154"
MsgBox "error"
End If

pView1.Modify 4, pRecord1



MsgBox "Done!"