Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get version number of a file

Status
Not open for further replies.

swetham

Programmer
May 5, 2010
257
DE
The path of the exe file is c:\newfolder\abc.exe. If i right click on the file,go to properties->version , in that assembly version number will be coming. I want that version from vb.net code.

Can anyone please help me?
 

Try this:


Dim sFileName As String = ("C:\Path\To\File\filename.ext")
'note - use the actual path and filename

Dim fvInfo As FileVersionInfo

fvInfo = FileVersionInfo.GetVersionInfo(sFileName)

MsgBox(fvInfo.FileVersion)


FileVersionInfo is in the System.Diagnostics namespace.


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Thanks for the reply, by using the above code i am getting the file version number. I got the assembly version number by using this code,

Imports System.Reflection
Dim asm As Assembly
asm = Assembly.LoadFrom(DPath & "\Lusail Task Sheet.exe")
file_assembly_version = asm.GetName().Version.ToString
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top