How to check an assembly's version?

  • Thread starter Thread starter Tee
  • Start date Start date
T

Tee

Hi,

How can we check an assembly's version that is created in .NET?

I have tried to load the assembly using
System.Reflection.Assembly.LoadFile and

GetCustomAttributes - AssemblyFileVersionAttribute, but couldn't get the
proper data, some of assemblies seem doesn't have
AssemblyFileVersionAttribute.



Can anyone help?



Thanks,

Tee
 
If you want to know the version of your assembly you can use:

Assembly.GetAssembly(typeof(Form1)).GetName().Version.ToString()

Where Form1 is a class defined in the assembly you want to know the version
of.
If you want to know the framework the application is using you could use a
class defined in the framework like:

Assembly.GetAssembly(typeof(int)).GetName().Version.ToString()
 
Try

using System.Reflection;

Assembly.GetExecutingAssembly().GetName().Version.ToString()
 

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