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?
Use FileVersionInfo.GetVersionInfo
, for example:
Dim myFileVersionInfo As FileVersionInfo =
FileVersionInfo.GetVersionInfo([Assembly].GetExecutingAssembly().Location)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With