Skip to content

Instantly share code, notes, and snippets.

@BrunoCaimar
Created October 29, 2012 19:48
Show Gist options
  • Save BrunoCaimar/3976096 to your computer and use it in GitHub Desktop.
Save BrunoCaimar/3976096 to your computer and use it in GitHub Desktop.
Versioning - .NET
How does the versioning work?
The first thing that I tried was to understand exactly how this magic number works in .NET.
If you go to the online MSDN article, you will find out that the version number of an assembly is composed by 4 numbers, and each one has a specific mean
1. Major = manually incremented for major releases, such as adding many new features to the solution.
0. Minor = manually incremented for minor releases, such as introducing small changes to existing features.
0. Build = typically incremented automatically as part of every build performed on the Build Server. This allows each build to be tracked and tested.
0 Revision = incremented for QFEs (a.k.a. “hotfixes” or patches) to builds released into the Production environment (PROD). This is set to zero for the initial release of any major/minor version of the solution.
@BrunoCaimar
Copy link
Author

string assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
string assemblyVersion = Assembly.LoadFile('your assembly file').GetName().Version.ToString();
string fileVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion;
string productVersion = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment