Assembly Version, Assembly File Version and Assembly Informational Version

.NET provides three assembly-level attributes for adding a version number to your .NET assembly:

[assembly: AssemblyVersionAttribute("")]
[assembly: AssemblyFileVersionAttribute("")]
[assembly: AssemblyInformationalVersion("")]

For the last few years I’ve often left the Assembly Version set to a fixed value (e.g. and then set the AssemblyFileVersionAttribute to the something based on a CI build number (e.g. for build 272).

For more info on the purpose of these assembly attributes see:

You can retrieve the value of the Assembly File Version within code.  This can be useful for things like displaying a version number in your UI.  Here’s the code:

var assemblyFileVersion = (AssemblyFileVersionAttribute)Assembly
  .GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false)
return assemblyFileVersion.Version;