Click here to Skip to main content
15,887,313 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
My project is with VC2010 . I use from a dll in this project. i register and use ".tlb" file of this Dll.
#import "C:\Windows\System32\MyDll.tlb" raw_interfaces_only


How do i determine the version of current dll, that is registerd in my system, when i'm compiling the project?

I want:
the exe logs, the version of Dll that exe is compiled with that
I mean:
I want to check Dll Version in compile time, (not runtime!!!)
I want to show "compile time version", in a Static box in about dialog.

What I have tried:

I want to show "compile time version" of Dll, in a Static box in about dialog.
Posted
Updated 17-Apr-17 21:12pm
v2
Comments
Richard MacCutchan 17-Apr-17 9:20am    
Check the linker logs to see if they provide that information. You may need to use the "verbose" option.
Zon-cpp 18-Apr-17 2:10am    
I mean: I want check Dll Version in compile time, (not runtime!!!)
I want show compile time version, in a Static box in about dialog.
Richard MacCutchan 18-Apr-17 2:47am    
How do you think that can be achieved without writing a program to do it?

1 solution

You have to create a user defined build step that makes this informatiomn available to your application before compiling. See Understanding Custom Build Steps and Build Events (VS 2010)[^].

A possible solution would be writing a batch / command file that gets the version string from the DLL and creates a header file containing a single line with the definition for the version string. Your about box dialog source file can the inlcude this header file.

To get the version from the DLL you need a command line tool. One solution is using the PowerShell with
(Get-Item path-to-dll).VersionInfo.FileVersion

Another solution is to use the Sigcheck[^] utility from the SysInternal tools.

Or write our own utility that reads the information using the GetFileVersionInfo function (Windows)[^] and creates the header file.
 
Share this answer
 
Comments
Zon-cpp 18-Apr-17 3:30am    
thank you @Jochen Arndt, I'll try to do these solutions and to comment the result to you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900