How to extract the version from Assembly.FullName ?

  • Thread starter Thread starter julien
  • Start date Start date
J

julien

Hello,
Assembly.FullName give information about a DLL, including the version
w.x.y.z.

Is there a way to extract the version directly from the assembly, or do
I have to extract it from Assembly.FullName?

Thank you
Julien
 
Hello,
Assembly.FullName give information about a DLL, including the
version w.x.y.z.

Is there a way to extract the version directly from the
assembly, or do I have to extract it from Assembly.FullName?

Julien,

A simple regular expression can be used to extract the assembly's
version number:

Assembly sampleAssembly = Assembly.GetAssembly(1.GetType());
Console.WriteLine(Regex.Match(sampleAssembly.FullName, @"\d+\.\d+\.\d+\.\d+").ToString());
 
Is there a way to extract the version directly from the assembly, or do
I have to extract it from Assembly.FullName?

Assembly.GetName().Version



Mattias
 
Back
Top