Getting NSIS File Version with C# -
i have scripted installer using nsis , added version information via viproductversion , viaddversionkey commands. when view properties of compiled file, version information there expect be.
my problem when attempt version information via c# command fileversioninfo.getversioninfo(filename).fileversion, returns empty string.
here quick way replicate:
nsis script
!include logiclib.nsh !include filefunc.nsh !define product_name "installer" !define product_version "1.0.0.2" name "${product_name} ${product_version}" viproductversion "${product_version}" viaddversionkey productversion "${product_version}" outfile "setup.exe" section "installer" sectionend c# code
class program { static void main(string[] args) { fileversioninfo fvi = fileversioninfo.getversioninfo("setup.exe"); if (fvi != null) { console.writeline(string.format("file version: {0}", fvi.fileversion)); } else { console.writeline("could not load file version info"); } console.writeline("press key continue..."); console.read(); } } this gives output of:
file version: press key continue... what need read fileversion 1.0.0.2?
i figured out doing wrong. though looked correct in properties dialog, using wrong value viaddversionkey. have read correctly, should use viaddversionkey fileversion "${product_version}"
Comments
Post a Comment