Assembly Information Class (In response to lack of information)

jspencer

Regular
Joined
Jan 30, 2003
Location
London, UK
Visual Basic:
Imports System.Reflection

Public Class AssemblyInformation
    Public ReadOnly Property ProjectDescription()
        Get
            Dim asm As AssemblyDescriptionAttribute
            asm = Attribute.GetCustomAttribute([Assembly].GetExecutingAssembly, GetType(AssemblyDescriptionAttribute))
            Return asm.Description
        End Get
    End Property

    Public ReadOnly Property Copyright()
        Get
            Dim asm As AssemblyCopyrightAttribute
            asm = Attribute.GetCustomAttribute([Assembly].GetExecutingAssembly, GetType(AssemblyCopyrightAttribute))
            Return asm.Copyright
        End Get
    End Property

    Public ReadOnly Property Company()
        Get
            Dim asm As AssemblyCompanyAttribute
            asm = Attribute.GetCustomAttribute([Assembly].GetExecutingAssembly, GetType(AssemblyCompanyAttribute))
            Return asm.Company
        End Get
    End Property

    Public ReadOnly Property Title()
        Get
            Dim asm As AssemblyTitleAttribute
            asm = Attribute.GetCustomAttribute([Assembly].GetExecutingAssembly, GetType(AssemblyTitleAttribute))
            Return asm.Title
        End Get
    End Property

    Public ReadOnly Property Trademark()
        Get
            Dim asm As AssemblyTrademarkAttribute
            asm = Attribute.GetCustomAttribute([Assembly].GetExecutingAssembly, GetType(AssemblyTrademarkAttribute))
            Return asm.Trademark
        End Get
    End Property

    Public ReadOnly Property VersionMajor()
        Get
            Dim Ver As [Assembly]
            Return Ver.GetExecutingAssembly().GetName().Version.Major
        End Get
    End Property

    Public ReadOnly Property VersionMinor()
        Get
            Dim Ver As [Assembly]
            Return Ver.GetExecutingAssembly().GetName().Version.Minor
        End Get
    End Property

    Public ReadOnly Property VersionBuild()
        Get
            Dim Ver As [Assembly]
            Return Ver.GetExecutingAssembly().GetName().Version.Build
        End Get
    End Property

    Public ReadOnly Property VersionRevision()
        Get
            Dim Ver As [Assembly]
            Return Ver.GetExecutingAssembly().GetName().Version.Revision
        End Get
    End Property

    Public ReadOnly Property Version()
        Get
            Dim p_VerMajor, p_VerMinor, p_Build, p_Revision As String

            Dim Ver As [Assembly]
            p_VerMajor = Ver.GetExecutingAssembly().GetName().Version.Major
            p_VerMinor = Ver.GetExecutingAssembly().GetName().Version.Minor
            p_Build = Ver.GetExecutingAssembly().GetName().Version.Build
            p_Revision = Ver.GetExecutingAssembly().GetName().Version.Revision

            Return p_VerMajor & "." & p_VerMinor & "." & p_Build & "." & p_Revision
        End Get
    End Property

End Class

(This is a class that I found on the net and thought that someone else might find it helpful. Don't know who the original author was, but thank you anyway).
 
Last edited by a moderator:
Top Bottom