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,Filev ersion) 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.Reflect ion"
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.Reflecti on.Assembly
Dim attrCompany As AssemblyCompany Attribute
Dim attrConfigurati on As AssemblyConfigu rationAttribute
Dim attrCopyright As AssemblyCopyrig htAttribute
Dim attrCulture As AssemblyCulture Attribute
Dim attrDescription As AssemblyDescrip tionAttribute
Dim attrFileVersion As AssemblyFileVer sionAttribute
'get the currently executing assembly instance
curAsm = System.Reflecti on.Assembly.Get ExecutingAssemb ly()
'get the custom attributes in the assembly
Dim attrs() As Object
attrs =
curAsm.GetCusto mAttributes(Get Type(System.Ref lection.Assembl yCompanyAttribu t
e), False)
If attrs.Length > 0 Then
attrCompany = attrs(0)
Response.Write( "<br>" + attrCompany.Com pany.ToString() )
End If
attrs =
curAsm.GetCusto mAttributes(Get Type(System.Ref lection.Assembl yConfigurationA t
tribute), False)
If attrs.Length > 0 Then
attrConfigurati on = attrs(0)
Response.Write( "<br>" +
attrConfigurati on.Configuratio n.ToString())
End If
attrs =
curAsm.GetCusto mAttributes(Get Type(System.Ref lection.Assembl yCopyrightAttri b
ute), False)
If attrs.Length > 0 Then
attrCopyright = attrs(0)
Response.Write( "<br>" + attrCopyright.C opyright.ToStri ng())
End If
attrs =
curAsm.GetCusto mAttributes(Get Type(System.Ref lection.Assembl yCultureAttribu t
e), False)
If attrs.Length > 0 Then
attrCulture = attrs(0)
Response.Write( "<br>" + attrCulture.Cul ture.ToString() )
End If
attrs =
curAsm.GetCusto mAttributes(Get Type(System.Ref lection.Assembl yDescriptionAtt r
ibute), False)
If attrs.Length > 0 Then
attrDescription = attrs(0)
Response.Write( "<br>" + attrDescription .Description.To String())
End If
attrs =
curAsm.GetCusto mAttributes(Get Type(System.Ref lection.Assembl yFileVersionAtt r
ibute), False)
If attrs.Length > 0 Then
attrFileVersion = attrs(0)
Response.Write( "<br>" + attrFileVersion .Version.ToStri ng())
End If
'attrFileVersio n = (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.)