diff --git a/src/OpenWrap.Shell/BootstrapRunner.cs b/src/OpenWrap.Shell/BootstrapRunner.cs index 819342f..857aa7a 100644 --- a/src/OpenWrap.Shell/BootstrapRunner.cs +++ b/src/OpenWrap.Shell/BootstrapRunner.cs @@ -159,16 +159,24 @@ void LogFoundPackages(IEnumerable bootstrapPackages) void NotifyVersion(Assembly assembly) { - Version fileVersion = null; + SemanticVersion fileVersion = null; try { var version = FileVersionInfo.GetVersionInfo(assembly.Location); - fileVersion = new Version(version.FileVersion); + fileVersion = SemanticVersion.TryParseExact(version.FileVersion); } catch { } - _notifier.BootstraperIs(assembly.Location, fileVersion ?? assembly.GetName().Version); + if (fileVersion == null) + { + var attrib = Attribute.GetCustomAttribute(assembly, typeof(AssemblyInformationalVersionAttribute)); + if (attrib != null) + fileVersion = SemanticVersion.TryParseExact(((AssemblyInformationalVersionAttribute)attrib).InformationalVersion); + } + if (fileVersion == null) + fileVersion = SemanticVersion.TryParseExact(assembly.GetName().Version.ToString()); + _notifier.BootstraperIs(assembly.Location, fileVersion); } BootstrapResult ExecuteEntrypoint(string[] args, KeyValuePair> entryPoint) { diff --git a/src/OpenWrap.Shell/ConsoleNotifier.cs b/src/OpenWrap.Shell/ConsoleNotifier.cs index c98fffa..24d8ec7 100644 --- a/src/OpenWrap.Shell/ConsoleNotifier.cs +++ b/src/OpenWrap.Shell/ConsoleNotifier.cs @@ -1,5 +1,7 @@ using System; using System.Diagnostics; +using System.IO; +using System.Reflection; namespace OpenWrap { @@ -7,13 +9,15 @@ public class ConsoleNotifier : INotifier { int _downloadProgress; - public void BootstraperIs(string entrypointFile, Version entrypointVersion) + public void BootstraperIs(string entrypointFile, SemanticVersion entrypointVersion) { var version = FileVersionInfo.GetVersionInfo(typeof(ConsoleNotifier).Assembly.Location); - Console.WriteLine("# OpenWrap Shell {0}", version.FileVersion); - Console.WriteLine("# " + version.LegalCopyright); - Console.WriteLine("# Using {0} ({1})", entrypointFile, entrypointVersion); - Console.WriteLine(); + var entrypointName = AssemblyName.GetAssemblyName(entrypointFile).Name; + Console.WriteLine("# {0} v{1} (shell v{2})", entrypointName, entrypointVersion, version.FileVersion); + //Console.WriteLine("# OpenWrap Shell {0}", version.FileVersion); + //Console.WriteLine("# " + version.LegalCopyright); + //Console.WriteLine("# Using {0} ({1})", entrypointFile, entrypointVersion); + //Console.WriteLine(); } public BootstrapResult BootstrappingFailed(Exception exception) diff --git a/src/OpenWrap.Shell/INotifier.cs b/src/OpenWrap.Shell/INotifier.cs index 4a0cfbe..6689896 100644 --- a/src/OpenWrap.Shell/INotifier.cs +++ b/src/OpenWrap.Shell/INotifier.cs @@ -7,7 +7,7 @@ public interface INotifier : INotifyDownload { BootstrapResult BootstrappingFailed(Exception exception); BootstrapResult RunFailed(Exception e); - void BootstraperIs(string entrypointFile, Version entrypointVersion); + void BootstraperIs(string entrypointFile, SemanticVersion entrypointVersion); void Message(string message, params object[] messageParameters); InstallAction InstallOptions(); }