Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET General > .NET Assembly Info


Reply
 
Thread Tools Display Modes
  #1  
Old 06-29-2004, 01:25 PM
Fateseer Fateseer is offline
Freshman
 
Join Date: Jul 2003
Location: Sacramento, CA
Posts: 31
Question .NET Assembly Info


Hello!

I'm a long time reader, but this is the first time I've posted (usually find the answers I was looking for without posting).

I'm still attempting to convert from VB6 to VB.NET so forgive me if my terminology slips from time to time.

So...I'm building an app and attempting to put in a splash screen that will read the information I put in the AssemblyInfo.vb file. I have managed to get the AssemblyDescription and AssemblyVersion out...but can't seem to figure out how to get anything else out (for example: AssemblyTitle, AssemblyCompany, & AssemblyCopyright)

I didn't create any custom fields...just used what was there already.

Any suggestions?

Thanks in advance!
Reply With Quote
  #2  
Old 06-29-2004, 01:42 PM
MKoslof's Avatar
MKoslof MKoslof is offline
Cum Grano Salis

Retired Moderator
* Guru *
 
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
Default

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
Reply With Quote
  #3  
Old 06-29-2004, 03:14 PM
Fateseer Fateseer is offline
Freshman
 
Join Date: Jul 2003
Location: Sacramento, CA
Posts: 31
Default

That did the trick!

Now I just have to go through it and make sure I understand it all!
Then I might just be ready for some custom fields!

Thanks a lot!
Reply With Quote
  #4  
Old 06-29-2004, 03:16 PM
MKoslof's Avatar
MKoslof MKoslof is offline
Cum Grano Salis

Retired Moderator
* Guru *
 
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
Default

That's great news. Glad to help. Post again if you run into more trouble.
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->