Quoting from some answers from other people in these forums:
The GetName method on the Assembly will give you an instance of the
AssemblyName class. That will have a Version property which will return an
Version class instance. Once you have this, you should be able to use the
properties of the class (Build, Major, Minor, Revision) or you can get a
string representation by calling ToString.
(orig post by Nicholas Paldino [.NET/C# MVP] )
And:
************
Code Sample
************
try
{
Assembly a = Assembly.LoadFrom("FTPClient.dll");
Console.WriteLine("Image Runtime Version: {0}", a.FullName);
Debug.WriteLine("Image Runtime Version: " + a.FullName);
}
catch (Exception e)
{
Console.WriteLine("Exception occurred: {0}", e.Message);
}
finally
{
Console.ReadLine();
}
************
Output
************
Image Runtime Version: FTPClient, Version=1.0.1117.28417, Culture=neutral,
PublicKeyToken=null
(orig post by Mike Diehl)
Hope that gives you something to work with. Anyway, good luck!
Bob said:
I need to extract the version number of an assembly in my .NET Windows app.
The assembly is not referenced by this Windows app. I think I need to use
reflection but just can't figure out the coding. Could someone help?
Thanks a lot in advance
Bob