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

 

 

This entry was posted in C#.Net and tagged , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *