Skip to content

Instantly share code, notes, and snippets.

@DavidDeSloovere
Last active August 29, 2015 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidDeSloovere/c60ddb0cdc7e84dcccaf to your computer and use it in GitHub Desktop.
Save DavidDeSloovere/c60ddb0cdc7e84dcccaf to your computer and use it in GitHub Desktop.
Get the 3 versions that can be attached to an assembly via AssemblyInfo. Can be used in ASP.NET MVC to output the version in the footer.
var assembly = Assembly.GetExecutingAssembly();
var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
model.FileVersion = string.Format(CultureInfo.InvariantCulture, "v{0}", fvi.FileVersion);
model.ProductVersion = string.Format(CultureInfo.InvariantCulture, "v{0}", fvi.ProductVersion);
model.AssemblyVersion = string.Format(CultureInfo.InvariantCulture, "v{0}", assembly.GetName().Version);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment