diff --git a/DotNet.Extensions/DotNet.Extensions.csproj b/DotNet.Extensions/DotNet.Extensions.csproj index 0a8f7cc..48d9cde 100644 --- a/DotNet.Extensions/DotNet.Extensions.csproj +++ b/DotNet.Extensions/DotNet.Extensions.csproj @@ -16,6 +16,7 @@ Unlicense Extensions-512x512.png MikaelDui.Extensions + Mikael Dúi's .NET Extensions diff --git a/DotNet.Extensions/Reflection/AssemblyExtensions.cs b/DotNet.Extensions/Reflection/AssemblyExtensions.cs new file mode 100644 index 0000000..b46749b --- /dev/null +++ b/DotNet.Extensions/Reflection/AssemblyExtensions.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Text; + +namespace System.Reflection +{ + public static class AssemblyExtensions + { + /// + /// Like "1.2.3.0". + /// + public static string GetFileVersion(this Assembly assembly) => + assembly.GetCustomAttribute().Version; + + /// + /// Like "1.2.3+1a2b3c4d". + /// + public static string GetProductVersion(this Assembly assembly) => + FileVersionInfo.GetVersionInfo(assembly.Location).ProductVersion; + } +}