Last active
August 29, 2015 14:28
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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