joelilly
asked on
Read version from dll file
How do I determine (programmatically) what version of VSTO runtime the user is running?
My objective is to write out a logfile for a VS Tools for Office, Outlook Addin, upon catching any exception. My app installs the runtime (a requirement) to C:\Program Files\Common Files\Microsoft Shared\VSTO\8.0\AddinLoade r.dll. I can manually determine the version of this file but I want to do this in code for logging. Also, I can manually determine the version in the registry in the Update key of HKEY_LOCAL_MACHINE\SOFTWAR E\Microsof t\vsto runtime Setup\v8.0.50727. I'd rather avoid reading the registry in code in case the user isn't authorized. Is reading the version of a file object the correct way to do this?
I recall doing this in VB6 and am hoping to find a better way in .NET.
Thanks,
Joe
My objective is to write out a logfile for a VS Tools for Office, Outlook Addin, upon catching any exception. My app installs the runtime (a requirement) to C:\Program Files\Common Files\Microsoft Shared\VSTO\8.0\AddinLoade
I recall doing this in VB6 and am hoping to find a better way in .NET.
Thanks,
Joe
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!
ASKER
peetm: I'd been trying that until I read on MSDN that the filesystemobject doesn't provide version info. (see http://support.microsoft.com/kb/189751) The alternate solution there was to use the GetFileVersionInfo Windows API which, is what I was trying to avoid. Isn't that obsolete? The FileVersionInfo class that PaulHews posted is what I was looking for.
No idea what that is, but, check out the FileSystemObject's GetFileVersion method.