I want to store version in database table and don’t want to use varchar(max) for that. I want something fixed varchar(xxx)
Could you please tell, what’s the maximum possible length of FileVersionInfo.FileVersion on Windows Platforms?
Actually figured out how to get proper version:
var ver = FileVersionInfo.GetVersionInfo("D:\\oraociei11.dll").FileVersion;
This returns for Oracle lib:
OraOCIEI11.dll - 11.2.0.1.0 Production
oracore11.dll - 11.2.0.1.0 Production
oranls11.dll - 11.1.0.6.0 Production
orasnls11.dll - 11.1.0.6.0 Production
oraunls11.dll - 11.1.0.6.0 Production
oravsn11.dll - 11.2.0.2.0 Production
oracommon11.dll - 11.2.0.2.0 Production
orageneric11.dll - 11.2.0.2.0 Production
oraclient11.dll - 11.2.0.2.0 Production
orapls11.dll - 11.1.0.6.0 Production
orasql11.dll - 11.1.0.6.0 Production
oraxml11.dll - 11.1.0.6.0 Production
orahasgen11.dll - 11.2.0.1.0 Production
oraocrutl11.dll - 11.2.0.1.0 Production
oraocr11.dll - 11.2.0.1.0 Production
oraocrb11.dll - 11.2.0.1.0 Production
oranbeq11.dll - 11.2.0.2.0 Production
orantcp11.dll - 11.2.0.2.0 Production
orantcps11.dll - 11.2.0.2.0 Production
orannmp11.dll - 11.2.0.2.0 Production
orancds11.dll - 11.2.0.2.0 Production
oranldap11.dll - 11.2.0.2.0 Production
oraldapclnt11.dll - 10.1.4.0.1 Production
oraolapapi11.dll -
oranhost11.dll - 11.2.0.2.0 Production
orantns11.dll - 11.2.0.2.0 Production
oranoname11.dll -
oransgr11.dll - 11.2.0.2.0 Production
orancrypt11.dll - 11.2.0.2.0 Production
oransgr11.dll - 11.2.0.2.0 Production
oranl11.dll - 11.2.0.2.0 Production
oranro11.dll - 11.2.0.2.0 Production
oranbeq11.dll - 11.2.0.2.0 Production
orantcps11.dll - 11.2.0.2.0 Production
orannmp11.dll - 11.2.0.2.0 Production
orancds11.dll - 11.2.0.2.0 Production
oranldap11.dll - 11.2.0.2.0 Production
oraldapclnt11.dll - 10.1.4.0.1 Production
orannzsbb11.dll - 11.0.0.1.0 Production
oran11.dll - 11.2.0.2.0 Production
orannzmcs11.dll - 11.0.0.1.0 Production
oranjssl11.dll - 11.2.0.2.0 Production
oranjni11.dll - 11.2.0.2.0 Production
oranipc11.dll - 11.2.0.2.0 Production
To get version of file in proper way:
var versionInfo = FileVersionInfo.GetVersionInfo("D:\\oraociei11.dll");
var properVersion = string.Format("{0}.{1}.{2}.{3}", versionInfo.FileMajorPart, versionInfo.FileMinorPart, versionInfo.FileBuildPart, versionInfo.FilePrivatePart);
Thanks guys for participating!
No, FileVersion is a string and can contain anything. The Visual Studio resource editor allows entering a string of up to 300 characters. That is however not enforced by the resource compiler, longer strings can be entered by editing the .rc file by hand.
What you’ll want to do is synthesize the version string yourself, like this:
Which then ensures this string can never be larger than 23 characters.