Closed X-Guardian closed 4 years ago
Property may show FixedFileInfo.FileVersion.
Hi @zetamatta, my versioninfo.json doesn't have the FixedFileInfo
section.
My json as sample .
{
"FixedFileInfo":
{
"FileVersion": {
"Major": 4,
"Minor": 2,
"Patch": 0,
"Build": 5
},
"ProductVersion": {
"Major": 4,
"Minor": 2,
"Patch": 0,
"Build": 5
},
"FileFlagsMask": "3f",
"FileFlags ": "00",
"FileOS": "040004",
"FileType": "01",
"FileSubType": "00"
},
"StringFileInfo":
{
"Comments": "",
"CompanyName": "NYAOS.ORG",
"FileDescription": "Extended Commandline Shell",
"FileVersion": "4.2.0_5",
"InternalName": "",
"LegalCopyright": "Copyright (C) 2014-2017 HAYAMA_Kaoru",
"LegalTrademarks": "",
"OriginalFilename": "NYAGOS.EXE",
"PrivateBuild": "",
"ProductName": "Nihongo Yet Another GOing Shell",
"ProductVersion": "4.2.0_5",
"SpecialBuild": ""
},
"VarFileInfo":
{
"Translation": {
"LangID": "0411",
"CharsetID": "04E4"
}
}
}
With this JSON, the property of the executable shows
4.2.0.5
(which does NOT include underscore _
)4.2.0_5
(which includes underscore _
)If you want to change the fileversion of the property, you have to write FixedFileInfo (not StringFileInfo).
@zetamatta, what's the point in having the FileVersion in StringFileInfo then?
StringFileInfo
has the version information as a string. FixedFileInfo
does as four integers.
StringFileInfo
can contain the word such as -alpha
,-beta
or -RC1
.
FixedFileInfo
can not, but when two files of executables are given, we can judge which is newer by FixedFileInfo
correctly because they are simple integers.
I do not know why the Windows Explorer shows only StringFileInfo.ProductVersion
and FixedFileInfo.FileVersion
.
But, StringFileInfo.FileVersion
and FixedFileInfo.ProductVersion
are not discarded. We can read the version information all from executable files by powershell script as below.
# check.ps1
$v = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($Args[0])
if( $v ){
Write-Host("FileVersion(StringFileInfo)=",$v.FileVersion)
Write-Host(" FileMajorPart(FixedFileInfo)=",$v.FileMajorPart)
Write-Host(" FileMinorPart(FixedFileInfo)=",$v.FileMinorPart)
Write-Host(" FileBuildPart(FixedFileInfo)=",$v.FileBuildPart)
Write-Host(" FilePrivatePart(FixedFileInfo)=",$v.FilePrivatePart)
Write-Host("ProductVersion(StringFileInfo)=",$v.ProductVersion)
Write-Host(" ProductMajorPart(FixedFileInfo)=",$v.ProductMajorPart)
Write-Host(" ProductMinorPart(FixedFileInfo)=",$v.ProductMinorPart)
Write-Host(" ProductBuildPart(FixedFileInfo)=",$v.ProductBuildPart)
Write-Host(" ProductPrivatePart(FixedFileInfo)=",$v.ProductPrivatePart)
}
[C:\] powershell -ExecutionPolicy RemoteSigned -file check.ps1 YOUREXECUTABLE.exe
FileVersion(StringFileInfo)= 4.3.3_2
FileMajorPart(FixedFileInfo)= 4
FileMinorPart(FixedFileInfo)= 3
FileBuildPart(FixedFileInfo)= 3
FilePrivatePart(FixedFileInfo)= 2
ProductVersion(StringFileInfo)= 4.3.3_2
ProductMajorPart(FixedFileInfo)= 4
ProductMinorPart(FixedFileInfo)= 3
ProductBuildPart(FixedFileInfo)= 3
ProductPrivatePart(FixedFileInfo)= 2
@zetamatta Thanks for providing all this information - this is very helpful to users of this package!
Cheers @zetamatta, yes I can see the same result from my exe. Even worse is that explorer displays the StringFileInfo/ProductVersion
in preference to the FixedFileInfo/ProductVersion
, so it is not even consistent. What a mess from Microsoft!
@josephspurrier, what do you think about adding a GoVersionInfo parameter that would populate both the FixedFileInfo
and StringFileInfo
product and file version properties with the same values taken from the StringFileInfo
properties?
@X-Guardian I think it would be good to streamline the process. How about changing the behavior so that if only the -product-version and -file-version are specified, then the other file and product versions are filled from those?
@josephspurrier, that would work great for me.
Would you mind submitting a pull request with the changes?
Closing due to inactivity.
Hi @josephspurrier,
I'm trying to set the
File version
property using theStringFileInfo
FileVersion
setting, but the property in the executable always has a value of0.0.0.0
.I also get the same result if I use the
file-version
command-line flag.Example versioninfo.json: