I use maven, I have a maven-project with version X.Y.Z-SNAPSHOT, and I use maven-nsis-plugin. Because the Version is in format X.Y.Z-SNAPSHOT, I have to remove this suffix and repace it with a 0.
The maven plugin maven-nsis-plugin generates a project.nsh:
!define PROJECT_VERSION "4.23.9-SNAPSHOT"
which is used in my setup.nsi:
!include target\project.nsh
Section VersionReplace
Push "${PROJECT_VERSION}"
Push "-SNAPSHOT"
Push "0"
Call StrRep
Pop $0
!define VERSION_SHORT $0
SectionEnd
Name "Installer ${VERSION_SHORT}"
(...)
VIProductVersion ${VERSION_SHORT}
Problem: In the Console i can see:
Name: "Installer $0"
(...)
VIAddVersionKey: "ProductVersion" "$0"
so the $0 is not replaced. What am I doing wrong?
Replacement function used: StrRep
This can be done using the !searchreplace command, which runs at compile time
!searchreplace PROJECT_VERSION_SHORT ${PROJECT_VERSION} "-SNAPSHOT" ".0"