Old 11th January 2007, 06:58   #1
Nniol
Junior Member
 
Join Date: Oct 2006
Posts: 26
Dynamic Version Information

Hi,

My install is rebuilt every night form a nightly build script, however ther version of the install file, set in

VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "310.0.0.154"

VIProductVersion "310.0.0.154"

Must be the same the executable about to be installed, this can be retrieved using GetDllVersionLocal, however seeing as VIAddVersionkey and VIProductVersion can not be in Sections or Functions it is hard to make dynamic.

Is it possible to retrieve the version information in .onInit and then assign it to a variable which is later assigned in VIAddVersionKey and VIProductVersion

VIProductVersion $DynamicallyDeterminedVersionNumber
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" $DynamicallyDeterminedVersionNumber


Nniol
Nniol is offline   Reply With Quote
Old 11th January 2007, 07:47   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
on the top of your script execute with !system an exe that retrieves the desired info and adds them as defines to a header e.g. versions.nsh and then !include versions.nsh to your script.
e.g.
the small exe:
section
FileOpen $0 '$EXEDIR\versions.nsh
call GetDllVersionLocal
FileWrite $0 '!define File_Ver "<resulting_var_from_call>"$\r$\n'
FileClose $0
sectionend

the main script,
!system "$EXEDIR\small.exe"
!include versions.nsh
............
VIProductVersion "${File_Ver}"

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 11th January 2007, 07:50   #3
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
edit: Red Wine beat me to it, that should teach me not to read some random blog before hitting submit

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 11th January 2007, 08:05   #4
Nniol
Junior Member
 
Join Date: Oct 2006
Posts: 26
Thaanks guys, a real life saver there

Nniol (not so Insane anymore)
Nniol is offline   Reply With Quote
Old 11th January 2007, 11:45   #5
niteflyer
Member
 
Join Date: Mar 2004
Posts: 73
This macro does the same and a little more:
http://nsis.sourceforge.net/NfUtils_...SetVersionInfo
niteflyer is offline   Reply With Quote
Old 11th January 2007, 12:28   #6
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
Quote:
Originally posted by niteflyer
This macro does the same and a little more:
http://nsis.sourceforge.net/NfUtils_...SetVersionInfo
No doubt, though, I'd need an example to show me how to achieve the requested by Nniol issue. That's why my preferred way was the very simple code above

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 11th January 2007, 12:47   #7
niteflyer
Member
 
Join Date: Mar 2004
Posts: 73
${nfu.SetVersionInfo} does not include /LANG= in VIAddVersionKey but you could use ${nfu.!FileVersion} to store the version in a symbol:

code:

${nfu.!FileVersion} DynamicallyDeterminedVersionNumber "c:\myproject\myapp.exe"
VIProductVersion ${DynamicallyDeterminedVersionNumber}
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" ${DynamicallyDeterminedVersionNumber}


should do it (untested).

see http://nsis.sourceforge.net/NfUtils_....21FileVersion

If you dont need /LANG in VIAddVersionKey then you might want to use

code:

${nfu.SetVersionInfo} "My Installer" "c:\myproject\myapp.exe" "My Company" "My Copyright 2007" "No Comments"

niteflyer is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump