> I'm trying to put together a class that retrieves version information from
> my assembly and am having a problem. The code below happily retrieves the
> AssemblyTitle and AssemblyDescription but fails to retrieve the Version
> number. Both of these are specified in the AssemblyInfo.cs file, so I can't
> see why I can't get the version umber. Any suggestions?
A long time ago, somewhere deep within the msdn docs, I read that the
AssemblyVersionAttribute is some kind of special attribute that you
cannot retrieve like other attributes. You have to use something like that:
public string ProductVersion() {
return Assembly.GetExecutingAssembly().GetName().Version.ToString();
}
.. haven't tested it, but should work. As far as I know, that's the
easiest way to get at the version information specified in the
AssemblyVersion"Attribute".
hth,
Max
Steve Barnett - 25 Aug 2006 11:16 GMT
Just when I thought I was starting to get a handle on this stuff, they go
and throw me a curve-ball like this.
Worked perfectly, thanks.
Steve
>> I'm trying to put together a class that retrieves version information
>> from my assembly and am having a problem. The code below happily
[quoted text clipped - 16 lines]
> hth,
> Max