473,395 Members | 1,341 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Retrieving information from AssemblyInfo.vb

Rob
What VB run-time methods are available to retrieve
information (such as AssemblyCopyright, AssemblyProduct,
AssemblyVersion, etc.) from the AssemblyInfo.vb file for
the current executable?

Thank you in advance for any help.
Nov 18 '05 #1
2 1968
Hi AAguiar,

Thank you for using Microsoft Newsgroup Service. Based on your description.
You want to get the custom attributes info in the AssemblyInfo.vb file
generated by the VS.NET? If my understanding of your problem is correct,
here is my suggestion:

In dotnet, all such custom attributes are Assembly based. For example, when
you build and run your ASP.NET application, all the atrributes( such as
Copyright,Fileversion) are set as the Assemly Custom Attribute of the whole
Application Assemlbly. You can get such info mation of a dotnet Assembly
via the classes and methods under the "System.Reflection"
namespace.

For example, here is a method to get the currently executing Assembly's
custom attributes: ( you can use it in a ASP.NET application)

Protected Sub GetAssemblyInfo()

Dim curAsm As System.Reflection.Assembly
Dim attrCompany As AssemblyCompanyAttribute
Dim attrConfiguration As AssemblyConfigurationAttribute
Dim attrCopyright As AssemblyCopyrightAttribute
Dim attrCulture As AssemblyCultureAttribute
Dim attrDescription As AssemblyDescriptionAttribute
Dim attrFileVersion As AssemblyFileVersionAttribute
'get the currently executing assembly instance
curAsm = System.Reflection.Assembly.GetExecutingAssembly()

'get the custom attributes in the assembly
Dim attrs() As Object
attrs =
curAsm.GetCustomAttributes(GetType(System.Reflecti on.AssemblyCompanyAttribut
e), False)
If attrs.Length > 0 Then
attrCompany = attrs(0)
Response.Write("<br>" + attrCompany.Company.ToString())
End If

attrs =
curAsm.GetCustomAttributes(GetType(System.Reflecti on.AssemblyConfigurationAt
tribute), False)
If attrs.Length > 0 Then
attrConfiguration = attrs(0)
Response.Write("<br>" +
attrConfiguration.Configuration.ToString())
End If

attrs =
curAsm.GetCustomAttributes(GetType(System.Reflecti on.AssemblyCopyrightAttrib
ute), False)
If attrs.Length > 0 Then
attrCopyright = attrs(0)
Response.Write("<br>" + attrCopyright.Copyright.ToString())
End If

attrs =
curAsm.GetCustomAttributes(GetType(System.Reflecti on.AssemblyCultureAttribut
e), False)
If attrs.Length > 0 Then
attrCulture = attrs(0)
Response.Write("<br>" + attrCulture.Culture.ToString())
End If

attrs =
curAsm.GetCustomAttributes(GetType(System.Reflecti on.AssemblyDescriptionAttr
ibute), False)
If attrs.Length > 0 Then
attrDescription = attrs(0)
Response.Write("<br>" + attrDescription.Description.ToString())
End If

attrs =
curAsm.GetCustomAttributes(GetType(System.Reflecti on.AssemblyFileVersionAttr
ibute), False)
If attrs.Length > 0 Then
attrFileVersion = attrs(0)
Response.Write("<br>" + attrFileVersion.Version.ToString())

End If

'attrFileVersion = (0)

End Sub

For more other infos about using dotnet reflecting to retrieve infomation
in a Assembly file, you can visit the following link on MSDN:
http://msdn.microsoft.com/library/en...mblies.asp?fra
me=true
Please try out the preceding suggestions and let me know whether they help.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #2
Rob
Thanks Mr. Cheng.
That is exactly what I was looking for!

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Robert Scheer | last post by:
Hi. I tried to compile a windows forms app without the assemblyinfo.vb file, and it compiled ok. So, if I delete the assemblyinfo.vb file from my project what kinds of problems would I have? ...
2
by: Eddie | last post by:
Hello, there. When I create new 'VC++ -> CLR -> Windows Form Application' project, there created AssemblyInfo.cpp file. There exists strings like ; I believe this information should be...
2
by: Orgbrat | last post by:
Is there a way to retrieve a WinForms application information such as Company, Product and Version from within a class library ( DLL ) that the Winforms application is using. Specificly the...
2
by: Sakke | last post by:
Hello! We have written a GCryptoSvr.dll COM server in C++. Inside that resides WebClient COM component. WebClient CLSID is {8DC27D48-F94C-434B-A509-C3E1A3E75B9E}. When we are using that...
1
by: jimmyfo | last post by:
Hi, I recently wrote an ASP.Net web application in VS2005 and published (using VS2005 Publish feature) it to a relatively clean machine with ASP.Net 2.0 and MDAC 2.8 installed on it. However, when...
12
by: Zytan | last post by:
The AssemblyInfo.cs file shows company information in two places: Where does this come from? How can I change it? Right now COMPANY_NAME is blank, but I noticed that for VB and C#...
2
by: James Wong | last post by:
Hi everybody, I would like to know how to retrieve information from AssemblyInfo.vb inside web service. I've tried many different ways including GetExecutingAssembly or similar method but all...
0
by: The Coder | last post by:
I get a version tab in the shell only for VS_VERSION_INFO. I was expecting AssemblyInfo.cpp to create the version tab . Can I get AssemblyInfo.cpp to create version tab instead? If can not get...
10
by: =?Utf-8?B?SmFtZXMgV29uZw==?= | last post by:
Hi everybody, I'm trying to use the new VB 2008 right now and I want to know how to preset the company name and copyright informtion in Assembly Information. In my current VB 2005, company name...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.