Getting Assembly version information from your ASP.NET or Winforms application

Posted in: General vb.NET, ASP.NET
By dePoPo
Oct 31, 2009 - 9:00:41 AM


The following code samples show how to retrieve the assembly version information set from the GUI in your Winforms or ASP.NET application:

ASP.NET

        ' --- Retrieve version of the executing assembly, and display it on a label
        Dim s_version As String = System.Reflection.Assembly.GetExecutingAssembly.GetName.Version.ToString
        Label_Versie.Text = s_version


VB.NET Winforms or Console application

        ' --- Retrieve the assembly version info and display in the titlebar of the window
        Dim myBuildInfo As FileVersionInfo = FileVersionInfo.GetVersionInfo(Application.ExecutablePath)
        Dim s_versionstring As String = myBuildInfo.ProductMajorPart & "." & myBuildInfo.ProductMinorPart & "." & myBuildInfo.ProductBuildPart
        Me.Text = "Version " & s_versionstring





Visitor Comments