Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix not showing correct header info, issue #34 #312

Merged
merged 2 commits into from
Aug 7, 2018

Conversation

tynar
Copy link
Contributor

@tynar tynar commented Aug 2, 2018

Added preprocessor for .NET Standard and .NET Framework to fix HeadingInfo issue #34 .

…mework it's from AssemblyInfo, for .NET Standard file without extension.
@nemec
Copy link
Contributor

nemec commented Aug 2, 2018

I'm beginning to think a better solution may be to simply remove .dll from the end of the title if it exists. It won't require adding new preprocessors and will only affect those who intentionally end their title with .dll, for whatever reason, instead of all of NETSTANDARD.

@tynar I don't see a preprocessor for .NET Framework that calls Path.GetFileNameWithoutExtension, it would hit your #else and simply not trim. Since that trim call was added back in 2013, before Core even existed, .NET Framework users should get the behavior that trims .dll off the end as well as netstandard1_5.

Could you rewrite your change to remove just the string .dll from the end of the title, if it exists? If it passes the tests after that, we should be good to go.

@tynar
Copy link
Contributor Author

tynar commented Aug 2, 2018

Wasn't the intention to show the title from AssemblyInfo rather than looking for executed file name? That's why I left else part with title info which is available in .NET Framework.

@nemec
Copy link
Contributor

nemec commented Aug 3, 2018

Yes. Note that the existing code calls GetFileNameWithoutExtension on the title attribute, NOT the assembly name. I believe it's meant to solve a problem where, by default, the title attribute is given a name of something.dll if you did not manually set it yourself.

I think if you take the current published code and then replace

GetFileNameWithoutExtension(titleAttribute.Title)

with the following pseudocode (sorry I don't have the time to format it properly)

title = titleAttribute.Title
if title endswith ".dll"
    title = title.Substring(0, title.Length - ".dll".Length)

It should solve the original issue while keeping the spirit of the old behavior.

@nemec nemec changed the base branch from master to develop August 7, 2018 03:05
@nemec nemec merged commit f99cb9e into commandlineparser:develop Aug 7, 2018
@nemec
Copy link
Contributor

nemec commented Aug 7, 2018

That looks good to me @tynar, thank you for your contribution to the project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants