how to get version of dll or exe in CF

H

Henrik Bach

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

Henrik Bach
 
P

Peter Foot [MVP]

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
 
H

Henrik Bach

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
 
P

Paul G. Tobey [eMVP]

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
 
G

Geoff Schwab [MSFT]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top