473,465 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How To: Read AssemblyInfo Attributes @ runtime

Hey all,

Can anyone show me the proper C# syntax necessary to read
the attribute fields from the AssemblyInfo.cs file? I
have the following in VB.Net, but so far am unsuccessful
in translating the code to C#:

Dim objCopyright As AssemblyCopyrightAttribute = CType
(AssemblyCopyrightAttribute.GetCustomAttribute
(System.Reflection.Assembly.GetExecutingAssembly, GetType
(AssemblyCopyrightAttribute)), AssemblyCopyrightAttribute)

Dim objProduct As AssemblyProductAttribute = CType
(AssemblyProductAttribute.GetCustomAttribute
(System.Reflection.Assembly.GetExecutingAssembly, GetType
(AssemblyProductAttribute)), AssemblyProductAttribute)

Thanks!

J. Ptak

Nov 17 '05 #1
4 11813
I know the Visual Basic syntax for this

it uses the

System.Diagnostics.FileVersionInfo Class

Dim verInfo as System.Diagnostics.FileVersionInfo
verInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo( path as String)

then using the functions of verInfo you can get all information included in
the AssemblyInfo.vb File

Severin

"Jeff Ptak" <pt****@NOSPAM.corning.com> wrote in message
news:06****************************@phx.gbl...
Hey all,

Can anyone show me the proper C# syntax necessary to read
the attribute fields from the AssemblyInfo.cs file? I
have the following in VB.Net, but so far am unsuccessful
in translating the code to C#:

Dim objCopyright As AssemblyCopyrightAttribute = CType
(AssemblyCopyrightAttribute.GetCustomAttribute
(System.Reflection.Assembly.GetExecutingAssembly, GetType
(AssemblyCopyrightAttribute)), AssemblyCopyrightAttribute)

Dim objProduct As AssemblyProductAttribute = CType
(AssemblyProductAttribute.GetCustomAttribute
(System.Reflection.Assembly.GetExecutingAssembly, GetType
(AssemblyProductAttribute)), AssemblyProductAttribute)

Thanks!

J. Ptak

Nov 17 '05 #2
I know the Visual Basic syntax for this

it uses the

System.Diagnostics.FileVersionInfo Class

Dim verInfo as System.Diagnostics.FileVersionInfo
verInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo( path as String)

then using the functions of verInfo you can get all information included in
the AssemblyInfo.vb File

Severin

"Jeff Ptak" <pt****@NOSPAM.corning.com> wrote in message
news:06****************************@phx.gbl...
Hey all,

Can anyone show me the proper C# syntax necessary to read
the attribute fields from the AssemblyInfo.cs file? I
have the following in VB.Net, but so far am unsuccessful
in translating the code to C#:

Dim objCopyright As AssemblyCopyrightAttribute = CType
(AssemblyCopyrightAttribute.GetCustomAttribute
(System.Reflection.Assembly.GetExecutingAssembly, GetType
(AssemblyCopyrightAttribute)), AssemblyCopyrightAttribute)

Dim objProduct As AssemblyProductAttribute = CType
(AssemblyProductAttribute.GetCustomAttribute
(System.Reflection.Assembly.GetExecutingAssembly, GetType
(AssemblyProductAttribute)), AssemblyProductAttribute)

Thanks!

J. Ptak

Nov 17 '05 #3
Finally figured this out:

VB.NET Syntax:
Dim objCopyright As AssemblyCopyrightAttribute = CType
(AssemblyCopyrightAttribute.GetCustomAttribute
(System.Reflection.Assembly.GetExecutingAssembly, GetType
(AssemblyCopyrightAttribute)), AssemblyCopyrightAttribute)

C# Syntax:
AssemblyCopyrightAttribute objCopyright =
(AssemblyCopyrightAttribute)
AssemblyCopyrightAttribute.GetCustomAttribute
(System.Reflection.Assembly.GetExecutingAssembly() , typeof
(AssemblyCopyrightAttribute));

J. Ptak
-----Original Message-----
Hey all,

Can anyone show me the proper C# syntax necessary to read
the attribute fields from the AssemblyInfo.cs file? I
have the following in VB.Net, but so far am unsuccessful
in translating the code to C#:

Dim objCopyright As AssemblyCopyrightAttribute = CType
(AssemblyCopyrightAttribute.GetCustomAttribute
(System.Reflection.Assembly.GetExecutingAssembl y, GetType
(AssemblyCopyrightAttribute)), AssemblyCopyrightAttribute)

Dim objProduct As AssemblyProductAttribute = CType
(AssemblyProductAttribute.GetCustomAttribute
(System.Reflection.Assembly.GetExecutingAssembl y, GetType
(AssemblyProductAttribute)), AssemblyProductAttribute)

Thanks!

J. Ptak

.

Nov 17 '05 #4
Finally figured this out:

VB.NET Syntax:
Dim objCopyright As AssemblyCopyrightAttribute = CType
(AssemblyCopyrightAttribute.GetCustomAttribute
(System.Reflection.Assembly.GetExecutingAssembly, GetType
(AssemblyCopyrightAttribute)), AssemblyCopyrightAttribute)

C# Syntax:
AssemblyCopyrightAttribute objCopyright =
(AssemblyCopyrightAttribute)
AssemblyCopyrightAttribute.GetCustomAttribute
(System.Reflection.Assembly.GetExecutingAssembly() , typeof
(AssemblyCopyrightAttribute));

J. Ptak
-----Original Message-----
Hey all,

Can anyone show me the proper C# syntax necessary to read
the attribute fields from the AssemblyInfo.cs file? I
have the following in VB.Net, but so far am unsuccessful
in translating the code to C#:

Dim objCopyright As AssemblyCopyrightAttribute = CType
(AssemblyCopyrightAttribute.GetCustomAttribute
(System.Reflection.Assembly.GetExecutingAssembl y, GetType
(AssemblyCopyrightAttribute)), AssemblyCopyrightAttribute)

Dim objProduct As AssemblyProductAttribute = CType
(AssemblyProductAttribute.GetCustomAttribute
(System.Reflection.Assembly.GetExecutingAssembl y, GetType
(AssemblyProductAttribute)), AssemblyProductAttribute)

Thanks!

J. Ptak

.

Nov 17 '05 #5

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

Similar topics

1
by: Fred Iannon | last post by:
All, I am trying to figure out a clean solution to the following issues: (1) - We have a number of dlls/exes that need to have the same "values" for the various assembly attributes (like...
5
by: c8prog | last post by:
I'm using dotnetframework 1.1. By the way, I don't know how to read the information of AssemblyInfo.cs file. I wish to read it. The following Example Files. File 1: AssemblyInfo.cs using...
0
by: Sec_Newbie | last post by:
Why do I never see any intellisense from VS.NET (2003), when in AssemblyInfo.cs file? The below is my file with all the using statements that should at least present intellisense for...
0
by: Jeff Ptak | last post by:
Hey all, Can anyone show me the proper C# syntax necessary to read the attribute fields from the AssemblyInfo.cs file? I have the following in VB.Net, but so far am unsuccessful in translating...
2
by: Rob | last post by:
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? ...
0
by: xenophon | last post by:
In my 1.1 ASP.NET project, AssemblyInfo.cs had custom information about versioning and etc. With 2.0, I made an AssemblyInfo.cs in the root of my site, but with all of the multiple DLLs it appears...
1
by: Dragon | last post by:
What is the use of AssemblyInfo.cs
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...
1
by: Water Cooler v2 | last post by:
Who uses the AssemblyInfo.cs file? How is it used?
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
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,...
0
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,...
0
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...
0
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.