Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get file version

Tags:

.net

vb.net

I can get file version of exe(its own version) in vb6 by using App.Major ,App.Minor , App.Revision etc. But how can i get the same in vb.net. I tried using following 3 methods.

Text1.Text = My.Application.Info.Version.Major & "." & My.Application.Info.Version.Minor & "." & My.Application.Info.Version.Build & "." & My.Application.Info.Version.Revision

Text2.Text = Me.GetType.Assembly.GetName.Version.ToString()

Text3.Text = My.Application.Info.Version.ToString()

In all 3 cases it was returning assembly version(I checked it in bin folder where the exe created in a xp machine.In windows 8 i didnt see any option like assembly version when i see file properties)

By default both assembly and file versions are same.But when i changed it manually in project properties->applicationassembly information->File version i came to know my code is returning assembly version. So how can i get the file version? What is assembly and file vesrion?

like image 413
IT researcher Avatar asked Apr 05 '13 07:04

IT researcher


1 Answers

Use FileVersionInfo.GetVersionInfo, for example:

Dim myFileVersionInfo As FileVersionInfo =
    FileVersionInfo.GetVersionInfo([Assembly].GetExecutingAssembly().Location)
like image 57
Martin Prikryl Avatar answered Sep 30 '22 19:09

Martin Prikryl