Getting an assembly's version

  • Thread starter Thread starter Phil Jones
  • Start date Start date
P

Phil Jones

I think I'm missing something obvioius here - but I can't figure out where
to get the version details of an assembly.

I'm looking at the [Assembly] object, and I can't see anything (other than
ImageRuntimeVersion, which is the Runtime, not the actual assembly version).

Is there hidden somewhere else (or am I blindly missing it perhaps!!).

Thanks everyone.
 
Hi Phil,

Try this

Version vs = new Version( Application.ProductVersion );

You can then access the Version properties Major, Minor, Build, and
Revision.

If you need the version of an external assembly, not of the current
application, then the following may help

string assemblyName = myAssembly.FullName;
string [] parts = assemblyName.Split( new Char [] {','} );
string assemblyVersion = parts[1];

Or you can use

assembly.GetName().Version

HTH

Mona
 
try this:

Assembly assembly = [load the desired assembly here];
Console.WriteLine(assembly.GetName().Version);

hth
 
Back
Top