Skip to content

Commit 42db97c

Browse files
committed
Check if assembly title ends with '.dll' then just remove '.dll' part.
1 parent 044bda1 commit 42db97c

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/CommandLine/Text/HeadingInfo.cs

+11-12
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,18 @@ public static HeadingInfo Default
5555
{
5656
get
5757
{
58-
string title = ReflectionHelper.GetAssemblyName();
59-
#if NETSTANDARD1_5
60-
title = ReflectionHelper.GetAttribute<AssemblyTitleAttribute>()
58+
var title = ReflectionHelper.GetAttribute<AssemblyTitleAttribute>()
6159
.MapValueOrDefault(
62-
titleAttribute => Path.GetFileNameWithoutExtension(titleAttribute.Title),
63-
title);
64-
#else
65-
title = ReflectionHelper.GetAttribute<AssemblyTitleAttribute>()
66-
.MapValueOrDefault(
67-
titleAttribute => titleAttribute.Title,
68-
title);
69-
#endif
70-
60+
titleAttribute =>
61+
{
62+
if (titleAttribute.Title.ToLowerInvariant().EndsWith(".dll"))
63+
{
64+
return titleAttribute.Title.Substring(0, titleAttribute.Title.Length - ".dll".Length);
65+
}
66+
return titleAttribute.Title;
67+
},
68+
ReflectionHelper.GetAssemblyName());
69+
7170
var version = ReflectionHelper.GetAttribute<AssemblyInformationalVersionAttribute>()
7271
.MapValueOrDefault(
7372
versionAttribute => versionAttribute.InformationalVersion,

0 commit comments

Comments
 (0)