Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get assembley version c# 1

Status
Not open for further replies.

tomcoombs

Programmer
Aug 14, 2003
65
GB
I need to get the assembley version in runtime in c#. One one from the assembly.cs file

[assembly: AssemblyVersion("4.3.0.0")]


Thanks a million in advance...

Tom
 
Hi,

That is OK if you already reference System.Windows (as the Application class is defined in there)

A more generic way is to use reflection:

Code:
using System.Reflection;

...

// There are a few possiblilities here. 
// Look at the doc for the Assembly class
Assembly assbly = Assembly.GetExecutingAssembly():

string str = assbly.GetName().Version.ToString();

You also have properties on the version object (major, minor, etc.) which allows you to see each part of the version info.

Good Luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top