
06-29-2004, 01:42 PM
|
 |
Cum Grano Salis
Retired Moderator * Guru *
|
|
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
|
|
Well, if you want to extract the project's assembly info, use a class. Here is one that I use :
Code:
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
Module ShowAssemblyDemo
Public Class return_Assembly_Info
Private myType As Type
Public Sub New()
myType = GetType(MainMenu)
End Sub
Public ReadOnly Property AsmName() As String
Get
Return myType.Assembly.GetName.Name.ToString()
End Get
End Property
Public ReadOnly Property AsmFQName() As String
Get
Return myType.Assembly.GetName.FullName.ToString()
End Get
End Property
Public ReadOnly Property CodeBase() As String
Get
Return myType.Assembly.CodeBase
End Get
End Property
Public ReadOnly Property Copyright() As String
Get
Dim at As Type = GetType(AssemblyCopyrightAttribute)
Dim r() As Object = myType.Assembly.GetCustomAttributes(at, False)
Dim ct As AssemblyCopyrightAttribute = CType(r(0), AssemblyCopyrightAttribute)
Return ct.Copyright
End Get
End Property
Public ReadOnly Property Company() As String
Get
Dim at As Type = GetType(AssemblyCompanyAttribute)
Dim r() As Object = myType.Assembly.GetCustomAttributes(at, False)
Dim ct As AssemblyCompanyAttribute = CType(r(0), AssemblyCompanyAttribute)
Return ct.Company
End Get
End Property
Public ReadOnly Property Description() As String
Get
Dim at As Type = GetType(AssemblyDescriptionAttribute)
Dim r() As Object = myType.Assembly.GetCustomAttributes(at, False)
Dim da As AssemblyDescriptionAttribute = CType(r(0), AssemblyDescriptionAttribute)
Return da.Description
End Get
End Property
Public ReadOnly Property Product() As String
Get
Dim at As Type = GetType(AssemblyProductAttribute)
Dim r() As Object = myType.Assembly.GetCustomAttributes(at, False)
Dim pt As AssemblyProductAttribute = CType(r(0), AssemblyProductAttribute)
Return pt.Product
End Get
End Property
Public ReadOnly Property Title() As String
Get
Dim at As Type = GetType(AssemblyTitleAttribute)
Dim r() As Object = myType.Assembly.GetCustomAttributes(at, False)
Dim ta As AssemblyTitleAttribute = CType(r(0), AssemblyTitleAttribute)
Return ta.Title
End Get
End Property
Public ReadOnly Property Version() As String
Get
Return myType.Assembly.GetName.Version.ToString()
End Get
End Property
End Class
|
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
|