Firstly you can get and set version in Visual Studio as following, After images, you can get the version of currently executing assembly then you can use Application.ProductVersion.
Here is code snippet which can be used to do this.
1 2 3 4 |
Version version = new Version(Application.ProductVersion); MessageBox.Show(version.ToString()); |
To extract major, minor version use
1 2 3 4 5 |
Version version = new Version(Application.ProductVersion); MessageBox.Show("Version: {0}.{1}.{2}.{3}", version.Major, version.Minor, version.Build, version.Revision); |