473,387 Members | 1,779 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,387 software developers and data experts.

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 11809
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?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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,...

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.