how to get version of dll or exe in CF

  • Thread starter Thread starter Henrik Bach
  • Start date Start date
H

Henrik Bach

How do I programmatically get to the version of a .dll or .exe in the
Compact Framework?

Henrik Bach
 
Pete Vickers posted this yesterday:-
verMajor =
System.Reflection.Assembly.GetExecutingAssembly.GetName().Version.Major.ToSt
ring()
verMinor =
System.Reflection.Assembly.GetExecutingAssembly.GetName().Version.Minor.ToSt
ring()
verRev =
System.Reflection.Assembly.GetExecutingAssembly.GetName().Version.Revision.T
oString()

Peter
 
Well, yes, but I would like to get the version from a DLL on the device and
not one loaded in my program.

Henrik Bach
 
Unmanaged DLLs may not have version information in them, but the unmanaged
API consists of three functions:

DWORD GetFileVersionInfoSize(
LPTSTR lptstrFilename,
LPDWORD lpdwHandle
);BOOL GetFileVersionInfo(
LPTSTR lptstrFilename,
DWORD dwHandle,
DWORD dwLen,
LPVOID lpData
);BOOL VerQueryValue(
const LPVOID pBlock,
LPTSTR lpSubBlock,
LPVOID* lplpBuffer,
PUINT puLen
);I believe that these functions work just like their desktop
counterparts...I haven't done P/Invoke declarations for them, but they don't
 
If you search for GetFileVersionInfo with the .NET Compact Framework filter
on in the Help you will actually get a sample of how to use these using
P/Invoke.

--
Geoff Schwab
Program Manager
Excell Data Corporation
http://msdn.com/mobility

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top