Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 3rd October 2017, 16:23   #1
bruno
Junior Member
 
Join Date: Dec 2016
Posts: 6
Set the automatic version of myapplic.exe to VIAddVersionKey

Hello

my version of nsis : 2.46

I change the version manually with each compilation.

I would like to do it automatically.

I would like to take the version of myapplic.exe and put it directly in :
VIAddVersionKey / LANG = $ {LANG_FRENCH} "ProductVersion" "$ {PRODUCT_VERSION}".
It is a version of type: 2.4B for example.
I have browsed the forum but I do not get away with it. Someone can help me ?
Thank you
bruno is offline   Reply With Quote
Old 3rd October 2017, 17:39   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,611
2.46 is old, you should at least upgrade to 2.5x to get some important security fixes!

NSIS 3 has !getdllversion but it only reads the version number, not strings.

The best option is to use !searchparse on your .h/.rc source file.

The final option is to execute a helper application with !execute that reads the version and writes it to a .nsh file you can then !include. Resource Hacker can be used to extract resources from .exe files...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 3rd October 2017, 23:05   #3
Nutzzz
Junior Member
 
Join Date: May 2007
Location: Orange County, CA, U.S.A.
Posts: 18
What we do is keep the version number in an .h file that is parsed by our build script and set as an environment variable. We then use that environment variable for major versioning across the various pieces of the project. When it comes to the installer, it is passed to NSIS as a define via the command line, e.g.:
code:
makensis.exe /DPRODUCT_VERSION=%version% installer.nsi
Nutzzz is offline   Reply With Quote
Old 4th October 2017, 08:07   #4
bruno
Junior Member
 
Join Date: Dec 2016
Posts: 6
thanks for the answers.
So when i do the exe file of the application, i have to save too the version in a txt file like this :
!define EXE_VERSION 1.2D.
And i use it in the script with an !include to have the version.

Anders, you said my NSIS version is old. So The lastest NSIS 3.02.1 is good ?

thanks
bruno is offline   Reply With Quote
Old 4th October 2017, 11:03   #5
bruno
Junior Member
 
Join Date: Dec 2016
Posts: 6
Anders :

do you have an example of :

The best option is to use !searchparse on your .h/.rc source file.

The final option is to execute a helper application with !execute that reads the version and writes it to a .nsh file you can then !include. Resource Hacker can be used to extract resources from .exe files..

i have searched it on the forum but didn't find anything

thanks
bruno is offline   Reply With Quote
Old 4th October 2017, 12:34   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,611
You only have a .h and a .rc file if your program is written in C/C++.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 4th October 2017, 14:45   #7
bruno
Junior Member
 
Join Date: Dec 2016
Posts: 6
finally i did a powershell script who do my-app-version.txt
in NSIS script i call a batch file with the powershell command
!system "version.bat"
!include my-app-version.txt
bruno is offline   Reply With Quote
Old 6th October 2017, 00:41   #8
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,611
.h
Quote:
#define VERSTR "42.666beta"
.nsi
Quote:
!searchparse /file "resinfo.h" '#define VERSTR "' VERSTR '"'
VIAddVersionKey "ProductVersion" "${VERSTR}"

IntOp $PostCount $PostCount + 1
Anders 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