[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

Assembly Version via Reflection

Paul

11/25/2002 9:06:00 PM

Hi,

I'm trying to retrieve my assembly's version using
Reflection so my testers could report bugs appropriately.

I tried the following code, but I didn't see
AssemblyVersionAttribute:

object[] attribs = Assembly.GetExecutingAssembly
().GetCustomAttributes(true);
foreach (Attribute attrib in attribs)
{
AssemblyVersionAttribute ver = null;
if ((ver = attrib as AssemblyVersionAttribute) != null)
{
version.Text = "Version " + ver.Version;
break;
}
}

Can someone give a pointer?

Thanks,
Paul
2 Answers

Mattias Sjögren

11/25/2002 10:34:00 PM

0

Paul,

AssemblyVersionAttribute is a pseudo-custom attribute. It doesn't get
stored in metadata the way other custom attributes are, instead it
becomes part of the assembly name.

Assembly.GetExecutingAssembly().GetName().Version



Mattias

===
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.n...
Please reply only to the newsgroup.

Paul

11/26/2002 5:58:00 PM

0

Many thanks Mattias.

>-----Original Message-----
>Paul,
>
>AssemblyVersionAttribute is a pseudo-custom attribute. It=20
doesn't get
>stored in metadata the way other custom attributes are,=20
instead it
>becomes part of the assembly name.
>
>Assembly.GetExecutingAssembly().GetName().Version
>
>
>
>Mattias
>
>=3D=3D=3D
>Mattias Sj=F6gren [MVP] mattias @ mvps.org
>http://www.msjogren.n...
>Please reply only to the newsgroup.
>.
>