473,583 Members | 3,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Retrieving information from AssemblyInfo.vb

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

Thank you in advance for any help.
Nov 18 '05 #1
2 1978
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.)

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
1944
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? Thanks, Robert Scheer
2
1659
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 appeared in the file property
2
4445
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 applications specfic ApplicationData directory. This is not a problem from within the application, all you need to do is use Application.UserAppDataPath...
2
15696
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 WebClient COM component from C++ code it works just fine. However when we try to use that same WebClient in the same machine with following C# code: ...
1
9439
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 I try to create my SQL connection in the code-behind, I get the following error. I tried to register the DLL using regsvr32 but that errored out...
12
4349
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# installs on machines that already have VS with a company name, both VB and C# went and took this same company name (I think), and now it exists in...
2
2112
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 are failed. My main purpose is the version number stored in AssemblyInfo.vb. Thanks for your attention and kindly advice! Regards,
0
1971
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 AssemblyInfo.cpp to create version tab, then do I need to fill in both the AssemblyInfo.cpp and VS_VERSION_INFO resource? Does this mean that...
10
9657
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 and copyright information (the word "CopyRight" with company name and year) is filled in automatically once a new project is created. However, I...
0
7824
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8176
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8321
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7931
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5699
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5370
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3841
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1426
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.