ILT – How to Programmatically Get Version Information of a Visual Studio Solution

03-10-2012

How to get major, minor, build and revision version figures for a visual studio solution (using c#)?

// Step 1: Create a <a href="http://msdn.microsoft.com/en-us/library/system.version.aspx">Version</a> object

Version v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

// Step 2: Use Major, Minor, Build and Revision components in the Version object as you desire!
// e.g.

Version v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
lbVersion.Text = string.Format("V {0}.{1}.{2}", v.Major, v.Minor, v.Build);

Menol
ILT

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: