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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top