From 044bda1aa45408e38d7c06c21af75dfd3d7d171d Mon Sep 17 00:00:00 2001 From: tynar Date: Thu, 2 Aug 2018 23:22:54 +0200 Subject: [PATCH 1/2] add preprocessor for HeadingInfo to show correct Heading for .NET Framework it's from AssemblyInfo, for .NET Standard file without extension. --- src/CommandLine/Text/HeadingInfo.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/CommandLine/Text/HeadingInfo.cs b/src/CommandLine/Text/HeadingInfo.cs index 286a1872..c56462d4 100644 --- a/src/CommandLine/Text/HeadingInfo.cs +++ b/src/CommandLine/Text/HeadingInfo.cs @@ -55,10 +55,19 @@ public static HeadingInfo Default { get { - var title = ReflectionHelper.GetAttribute() + string title = ReflectionHelper.GetAssemblyName(); +#if NETSTANDARD1_5 + title = ReflectionHelper.GetAttribute() .MapValueOrDefault( titleAttribute => Path.GetFileNameWithoutExtension(titleAttribute.Title), - ReflectionHelper.GetAssemblyName()); + title); +#else + title = ReflectionHelper.GetAttribute() + .MapValueOrDefault( + titleAttribute => titleAttribute.Title, + title); +#endif + var version = ReflectionHelper.GetAttribute() .MapValueOrDefault( versionAttribute => versionAttribute.InformationalVersion, From 42db97cb0408d5c40cc5638fbd171272280f6644 Mon Sep 17 00:00:00 2001 From: tynar Date: Fri, 3 Aug 2018 23:22:09 +0200 Subject: [PATCH 2/2] Check if assembly title ends with '.dll' then just remove '.dll' part. --- src/CommandLine/Text/HeadingInfo.cs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/CommandLine/Text/HeadingInfo.cs b/src/CommandLine/Text/HeadingInfo.cs index c56462d4..d4d69565 100644 --- a/src/CommandLine/Text/HeadingInfo.cs +++ b/src/CommandLine/Text/HeadingInfo.cs @@ -55,19 +55,18 @@ public static HeadingInfo Default { get { - string title = ReflectionHelper.GetAssemblyName(); -#if NETSTANDARD1_5 - title = ReflectionHelper.GetAttribute() + var title = ReflectionHelper.GetAttribute() .MapValueOrDefault( - titleAttribute => Path.GetFileNameWithoutExtension(titleAttribute.Title), - title); -#else - title = ReflectionHelper.GetAttribute() - .MapValueOrDefault( - titleAttribute => titleAttribute.Title, - title); -#endif - + titleAttribute => + { + if (titleAttribute.Title.ToLowerInvariant().EndsWith(".dll")) + { + return titleAttribute.Title.Substring(0, titleAttribute.Title.Length - ".dll".Length); + } + return titleAttribute.Title; + }, + ReflectionHelper.GetAssemblyName()); + var version = ReflectionHelper.GetAttribute() .MapValueOrDefault( versionAttribute => versionAttribute.InformationalVersion,