I created an About box and am able to get all the assembly information from the program to show up in the About box except the Version.
I created the About box as a separate Windows application, changed the Output to Class Library, and compile it as a DLL. I then reference it from my program. In the About Box form's Public Sub New routine, I placed the following code, where I'm getting all the assembly attributes from the calling assembly. The problem is all attributes are coming in fine, except the Version attribute. For some reason the AssemblyVersion Attribute object doesn't exist in the assembly. How can I make sure the AssemblyVersion Attribute will be present like the others? Thanks.
-----------------------------------------------------------------------------------------------
mAssy = Reflection.Asse mbly.GetCalling Assembly
Dim aTitleAttr As AssemblyTitleAt tribute = _
AssemblyTitleAt tribute.GetCust omAttribute( _
mAssy, GetType(Assembl yTitleAttribute ))
Me.Text = "About " & aTitleAttr.Titl e
lblTitle.Text = aTitleAttr.Titl e
Dim aCopyRight As AssemblyCopyrig htAttribute = _
AssemblyCopyrig htAttribute.Get CustomAttribute ( _
mAssy, GetType(Assembl yCopyrightAttri bute))
lblCopyrightInf o.Text = aCopyRight.Copy right
Dim aDescription As AssemblyDescrip tionAttribute = _
AssemblyDescrip tionAttribute.G etCustomAttribu te( _
mAssy, GetType(Assembl yDescriptionAtt ribute))
lblDescription. Text = aDescription.De scription
Dim aVersion As AssemblyVersion Attribute = _
AssemblyVersion Attribute.GetCu stomAttribute( _
mAssy, GetType(Assembl yVersionAttribu te))
lblVersion.Text = aVersion.Versio n
---------------------------------------------------------------------------------------------
I created the About box as a separate Windows application, changed the Output to Class Library, and compile it as a DLL. I then reference it from my program. In the About Box form's Public Sub New routine, I placed the following code, where I'm getting all the assembly attributes from the calling assembly. The problem is all attributes are coming in fine, except the Version attribute. For some reason the AssemblyVersion Attribute object doesn't exist in the assembly. How can I make sure the AssemblyVersion Attribute will be present like the others? Thanks.
-----------------------------------------------------------------------------------------------
mAssy = Reflection.Asse mbly.GetCalling Assembly
Dim aTitleAttr As AssemblyTitleAt tribute = _
AssemblyTitleAt tribute.GetCust omAttribute( _
mAssy, GetType(Assembl yTitleAttribute ))
Me.Text = "About " & aTitleAttr.Titl e
lblTitle.Text = aTitleAttr.Titl e
Dim aCopyRight As AssemblyCopyrig htAttribute = _
AssemblyCopyrig htAttribute.Get CustomAttribute ( _
mAssy, GetType(Assembl yCopyrightAttri bute))
lblCopyrightInf o.Text = aCopyRight.Copy right
Dim aDescription As AssemblyDescrip tionAttribute = _
AssemblyDescrip tionAttribute.G etCustomAttribu te( _
mAssy, GetType(Assembl yDescriptionAtt ribute))
lblDescription. Text = aDescription.De scription
Dim aVersion As AssemblyVersion Attribute = _
AssemblyVersion Attribute.GetCu stomAttribute( _
mAssy, GetType(Assembl yVersionAttribu te))
lblVersion.Text = aVersion.Versio n
---------------------------------------------------------------------------------------------
Comment