Page 1 of 1
\"Get File Version\" not working
Posted: Tue Jan 24, 2006 5:22 pm
by gweihs
I am attempting to get the version number of a .NET executable. The WinXP Shell shows the version number properly in its property form. IA is returning 0.0.0.0. I am referencing it from $TARGETDIR$.
Any ideas?
Posted: Tue Jan 24, 2006 5:40 pm
by Gizm0
Well ,actually this is not a IA issue.It's true that GetFileVersionA returns 0.0.0.0 on .Net Assemblies.
This is because file version is stored as metadata in a .net assembly and not in the PE Header.
If you want to get the version of a .Net exe you should call an external dll that uses .net extensions (that means .net framework is a prequisite) to get AssemblyVersion number from the .Net assembly and return it IA setup script.
Posted: Tue Jan 24, 2006 5:40 pm
by CandiceJones
Hi
I believe this is because InstallAware uses the Win32 API for obtaining file versions. This API seems to fail on .NET files which contain version information in metadata form. I understand Explorer shows this correctly...but InstallAware cannot because this would make the script command dependent on the .NET framework, which is something we cannot do because we want your setups to always run, regardless of what frameworks are available (or not) on the target system.
Posted: Wed Jan 25, 2006 12:52 am
by casic
Hi,
the best way to retrieve file versions (also product versions) is to use the string resource table of a file. This works also with .NET libraries and executables. Unfortunately it is very hard to obtain these information (several API calls have to been made) so I think it's the best way to provide a plugin to resolve this issue (I already use such routines in the MSDE 2000 plugin). Let me see when this can be done
cu
Markus