Last active
April 1, 2019 15:46
-
-
Save jordanrobinson/0e399dd9c5f8686b9615341e51fcec3d to your computer and use it in GitHub Desktop.
Version Helper 1
This file contains hidden or 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
public static string VersionHash(this HtmlHelper helper) | |
{ | |
var assembly = typeof(TheCurrentClassYou'reCallingFrom).Assembly; | |
var attributes = assembly.GetCustomAttributes<AssemblyMetadataAttribute>(); | |
var hash = attributes.FirstOrDefault(a => a.Key == "GitHash")?.Value; | |
return hash?.Replace("-dirty", string.Empty); | |
} |
This file contains hidden or 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
public static string SiteVersion(this HtmlHelper helper) | |
{ | |
return typeof(HTMLExtensions).Assembly.GetName().Version.ToString(); | |
} |
This file contains hidden or 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
<script src="/_scripts/[email protected]()"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment