Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How To: Read AssemblyInfo Attributes @ runtime

Reply
Thread Tools

How To: Read AssemblyInfo Attributes @ runtime

 
 
Jeff Ptak
Guest
Posts: n/a
 
      07-14-2003
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

 
Reply With Quote
 
 
 
 
sampsons
Guest
Posts: n/a
 
      07-14-2003
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" <(E-Mail Removed)> wrote in message
news:065a01c34a1f$7cb9f870$(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
 
Jeff Ptak
Guest
Posts: n/a
 
      07-14-2003
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
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
assemblyinfo version =?Utf-8?B?TWFya0F1cml0?= ASP .Net 1 01-11-2005 08:47 PM
AssemblyInfo version display on WebPage =?Utf-8?B?Q2hyaXMgRmluaw==?= ASP .Net 2 10-08-2004 03:33 PM
What is [assembly: AssemblyConfiguration("")] for in AssemblyInfo.cs? Bob ASP .Net 0 06-08-2004 02:52 PM
Retrieving information from AssemblyInfo.vb Rob ASP .Net 2 12-17-2003 12:58 PM
AssemblyInfo C ASP .Net 2 11-28-2003 11:15 PM



Advertisments