Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.