Archive: VersionCompare and makensis.nsi


VersionCompare and makensis.nsi
Hi guys,

I want to incorporate versioning into our installer. I'm going to use VersionCompare and have been looking at an example called makensis.nsi in the Examples directory of NSIS.

How do the following values get defined in makensis.nsi.

VER_MAJOR
VER_MINOR
VER_REVISION
VER_BUILD


Regards

Paul

makensis is used by the compiler not something you should be messing with. I don't think you can directly set those variables, however you can set the version number in a x.x.x.x fashion (see below) and makensis will automatically translate it into VER_MAJOR.VER_MINOR.VER_REVISION.VER_BUILD

Directly from the manual

4.8.3 Version Information
4.8.3.1 VIAddVersionKey
[/LANG=lang_id] keyname value
Adds a field in the Version Tab of the File Properties. This can either be a field provided by the system or a user defined field. The following fields are provided by the System:

ProductName
Comments
CompanyName
LegalCopyright
FileDescription
FileVersion
ProductVersion
InternalName
LegalTrademarks
OriginalFilename
PrivateBuild
SpecialBuild
The name of these fields are translated on the target system, whereas user defined fields remain untranslated.

VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Test Application"
VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "A test comment"
VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "Fake company"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "Test Application is a trademark of Fake company"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© Fake company"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Test Application"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "1.2.3"

4.8.3.2 VIProductVersion
[version_string_X.X.X.X]
Adds the Product Version on top of the Version Tab in the Properties of the file.

VIProductVersion "1.2.3.4"


What you have posted I already have in my build script. What I didn't realise is that NSIS presumably takes the string VIProductVersion "1.2.3.4" and splits it then does the conversion to define:

VER_MAJOR.VER_MINOR.VER_REVISION.VER_BUILD


Thanks for that.

makensis.nsi is the build script used by NSIS and is purposely put into the Examples directory to learn from. There's lots of little gems in there so I recommend to anyone to have a look.

Regards.