Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Any way to update product version from commandline


3 replies to this topic

Mr.G

Mr.G
  • Members
  • 7 posts

Posted 16 November 2004 - 18:08

Hi,

I need to make msi packages from the command line, but I can't find out how to change the product version from the command line.

So right now I always have to open InstallShield Developer 8.0 sp2 just to change the product version and then run the NAnt script that checks out, builds and runns IsCmdBld.exe for the final msi package.

Regards
Simon G


Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 16 November 2004 - 22:39

This can be done using the automation interface and a VBScript. Would this be an acceptable work around? (if so I will dig up some sample code).
Regards
-Stein Åsmul

Mr.G

Mr.G
  • Members
  • 7 posts

Posted 17 November 2004 - 08:57

Oh yes indeed, no matter how, I just need to make it work.

I build the msi using the same computer as I develope the application. All workarounds are appreciated and accepted:)

Please dig some samples, thank you.

Regards
Simon G


MonkeyK

MonkeyK
  • Members
  • 33 posts

Posted 17 November 2004 - 22:51

I wanted to do something like this anyway, I went one step further and based the version number on the main program's version number (we never build an install without building a new version of the main executable)

So here it is, super-duper rough cause I just coded it.


CODE
'this is the project you will build
Dim mstrProject: mstrProject = "d:\MyProject"
'and the component which has the executable to base the version on
Dim ComponentVersionToUse: ComponentVersionToUse = "Program.exe"


main

Sub main()    
Dim lobjProj: Set lobjProj = CreateObject("ISWiAutomation.ISWiProject")
lobjProj.OpenProject mstrProject

Dim lobjComp
For Each lobjComp In lobjProj.ISWiComponents

'see if it is the file whos version we want to use
If (strComp(lobjComp.Name, ComponentVersionToUse, 1) = 0) Then
 lobjProj.ProductVersion = GetVersion(lobjComp.ISWiFiles(lobjComp.Keypath).FullPath, lobjComp.Name)
 if Len(lobjProj.ProductVersion) > 0 Then
  lobjProj.SaveProject()
 Else
  msgbox "Could not get the version to use"
 End IF
 Exit For
End If
Next
       
lobjProj.CloseProject
End Sub



Function GetVersion(strKeyPath, strName)
'verify the component file exists
Dim FSO: Set FSO = CreateObject("Scripting.FileSystemObject")
If not FSO.FileExists(strKeyPath) Then
 GetVersion = ""
Else
 GetVersion = FSO.getfileversion(strKeyPath)
End If
End Function