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

Added explicit support for .NET 4.6.1 and .NET Core 2.0. #400

Merged
merged 1 commit into from
Jan 27, 2019
Merged

Added explicit support for .NET 4.6.1 and .NET Core 2.0. #400

merged 1 commit into from
Jan 27, 2019

Conversation

ravenpride
Copy link
Contributor

I've added support for building the library explicitly for .NET 4.6.1 and .NET Core 2.0. Although .NET Standard 2.0 is implemented by these frameworks, referencing a .NET Standard library seems to pull in a lot of interfacing libraries that simply map calls from .NET Standard to the effective target platform.

This is the output directory of a simple .NET 4.6.1 console application just executing new CommandLine.Parser();

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       25.01.2019     07:04         211456 CommandLine.dll
-a----       25.01.2019     07:04          64600 CommandLine.pdb
-a----       25.01.2019     07:04         187024 CommandLine.xml
-a----       25.01.2019     07:06           4608 ConsoleApp1.exe
-a----       25.01.2019     07:06          18072 ConsoleApp1.exe.config
-a----       25.01.2019     07:06          15872 ConsoleApp1.pdb
-a----       10.01.2019     09:08          21216 Microsoft.Win32.Primitives.dll
-a----       10.01.2019     09:08          98616 netstandard.dll
-a----       10.01.2019     09:08          21176 System.AppContext.dll
-a----       10.01.2019     09:08          21224 System.Collections.Concurrent.dll
-a----       10.01.2019     09:08          21696 System.Collections.dll
-a----       10.01.2019     09:08          21224 System.Collections.NonGeneric.dll
-a----       10.01.2019     09:08          21224 System.Collections.Specialized.dll
-a----       10.01.2019     09:08          21192 System.ComponentModel.dll
-a----       10.01.2019     09:08          21768 System.ComponentModel.EventBasedAsync.dll
-a----       10.01.2019     09:08          21752 System.ComponentModel.Primitives.dll
-a----       10.01.2019     09:08          22784 System.ComponentModel.TypeConverter.dll
-a----       10.01.2019     09:08          21160 System.Console.dll
-a----       10.01.2019     09:08         154448 System.Data.Common.dll
-a----       10.01.2019     09:08          21736 System.Diagnostics.Contracts.dll
-a----       10.01.2019     09:08          21208 System.Diagnostics.Debug.dll
-a----       10.01.2019     09:08          21248 System.Diagnostics.FileVersionInfo.dll
-a----       10.01.2019     09:08          21728 System.Diagnostics.Process.dll
-a----       10.01.2019     09:08          23936 System.Diagnostics.StackTrace.dll
-a----       10.01.2019     09:08          21280 System.Diagnostics.TextWriterTraceListener.dll
-a----       10.01.2019     09:08          21208 System.Diagnostics.Tools.dll
-a----       10.01.2019     09:08          21744 System.Diagnostics.TraceSource.dll
-a----       10.01.2019     09:08          31608 System.Diagnostics.Tracing.dll
-a----       10.01.2019     09:08          21208 System.Drawing.Primitives.dll
-a----       10.01.2019     09:08          22224 System.Dynamic.Runtime.dll
-a----       10.01.2019     09:08          21744 System.Globalization.Calendars.dll
-a----       10.01.2019     09:08          21192 System.Globalization.dll
-a----       10.01.2019     09:08          25992 System.Globalization.Extensions.dll
-a----       10.01.2019     09:08         110944 System.IO.Compression.dll
-a----       10.01.2019     09:08          21224 System.IO.Compression.ZipFile.dll
-a----       10.01.2019     09:08          21144 System.IO.dll
-a----       10.01.2019     09:08          21192 System.IO.FileSystem.dll
-a----       10.01.2019     09:08          21232 System.IO.FileSystem.DriveInfo.dll
-a----       10.01.2019     09:08          21232 System.IO.FileSystem.Primitives.dll
-a----       10.01.2019     09:08          21224 System.IO.FileSystem.Watcher.dll
-a----       10.01.2019     09:08          21208 System.IO.IsolatedStorage.dll
-a----       10.01.2019     09:08          21216 System.IO.MemoryMappedFiles.dll
-a----       10.01.2019     09:08          21168 System.IO.Pipes.dll
-a----       10.01.2019     09:08          21232 System.IO.UnmanagedMemoryStream.dll
-a----       10.01.2019     09:08          21152 System.Linq.dll
-a----       10.01.2019     09:08          22224 System.Linq.Expressions.dll
-a----       10.01.2019     09:08          21192 System.Linq.Parallel.dll
-a----       10.01.2019     09:08          21192 System.Linq.Queryable.dll
-a----       10.01.2019     09:08         198472 System.Net.Http.dll
-a----       10.01.2019     09:08          21208 System.Net.NameResolution.dll
-a----       10.01.2019     09:08          22248 System.Net.NetworkInformation.dll
-a----       10.01.2019     09:08          21168 System.Net.Ping.dll
-a----       10.01.2019     09:08          22216 System.Net.Primitives.dll
-a----       10.01.2019     09:08          21184 System.Net.Requests.dll
-a----       10.01.2019     09:08          21696 System.Net.Security.dll
-a----       10.01.2019     09:08          30544 System.Net.Sockets.dll
-a----       10.01.2019     09:08          21232 System.Net.WebHeaderCollection.dll
-a----       10.01.2019     09:08          21224 System.Net.WebSockets.Client.dll
-a----       10.01.2019     09:08          21192 System.Net.WebSockets.dll
-a----       10.01.2019     09:08          21696 System.ObjectModel.dll
-a----       10.01.2019     09:08          22200 System.Reflection.dll
-a----       10.01.2019     09:08          21224 System.Reflection.Extensions.dll
-a----       10.01.2019     09:08          21736 System.Reflection.Primitives.dll
-a----       10.01.2019     09:08          21200 System.Resources.Reader.dll
-a----       10.01.2019     09:08          21232 System.Resources.ResourceManager.dll
-a----       10.01.2019     09:08          21200 System.Resources.Writer.dll
-a----       10.01.2019     09:08          21784 System.Runtime.CompilerServices.VisualC.dll
-a----       10.01.2019     09:08          29360 System.Runtime.dll
-a----       10.01.2019     09:08          21720 System.Runtime.Extensions.dll
-a----       10.01.2019     09:08          21200 System.Runtime.Handles.dll
-a----       10.01.2019     09:08          24296 System.Runtime.InteropServices.dll
-a----       10.01.2019     09:08          28624 System.Runtime.InteropServices.RuntimeInformation.dll
-a----       10.01.2019     09:08          21200 System.Runtime.Numerics.dll
-a----       10.01.2019     09:08          21264 System.Runtime.Serialization.Formatters.dll
-a----       10.01.2019     09:08          21240 System.Runtime.Serialization.Json.dll
-a----       10.01.2019     09:08          27048 System.Runtime.Serialization.Primitives.dll
-a----       10.01.2019     09:08          24816 System.Runtime.Serialization.Xml.dll
-a----       10.01.2019     09:08          21200 System.Security.Claims.dll
-a----       10.01.2019     09:08          47016 System.Security.Cryptography.Algorithms.dll
-a----       10.01.2019     09:08          21240 System.Security.Cryptography.Csp.dll
-a----       10.01.2019     09:08          21256 System.Security.Cryptography.Encoding.dll
-a----       10.01.2019     09:08          21784 System.Security.Cryptography.Primitives.dll
-a----       10.01.2019     09:08          22832 System.Security.Cryptography.X509Certificates.dll
-a----       10.01.2019     09:08          21208 System.Security.Principal.dll
-a----       10.01.2019     09:08          22392 System.Security.SecureString.dll
-a----       10.01.2019     09:08          21696 System.Text.Encoding.dll
-a----       10.01.2019     09:08          21232 System.Text.Encoding.Extensions.dll
-a----       10.01.2019     09:08          21232 System.Text.RegularExpressions.dll
-a----       10.01.2019     09:08          22192 System.Threading.dll
-a----       10.01.2019     09:08          37752 System.Threading.Overlapped.dll
-a----       10.01.2019     09:08          22224 System.Threading.Tasks.dll
-a----       10.01.2019     09:08          21232 System.Threading.Tasks.Parallel.dll
-a----       10.01.2019     09:08          21200 System.Threading.Thread.dll
-a----       10.01.2019     09:08          21216 System.Threading.ThreadPool.dll
-a----       10.01.2019     09:08          21200 System.Threading.Timer.dll
-a----       10.01.2019     09:08          79176 System.ValueTuple.dll
-a----       10.01.2019     09:08          21712 System.Xml.ReaderWriter.dll
-a----       10.01.2019     09:08          21696 System.Xml.XDocument.dll
-a----       10.01.2019     09:08          21712 System.Xml.XmlDocument.dll
-a----       10.01.2019     09:08          21712 System.Xml.XmlSerializer.dll
-a----       10.01.2019     09:08          21176 System.Xml.XPath.dll
-a----       10.01.2019     09:08          22904 System.Xml.XPath.XDocument.dll

And this is the output directory of the console application after adding explicit support for.NET 4.6.1:

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       25.01.2019     07:12         211456 CommandLine.dll
-a----       25.01.2019     07:12          64600 CommandLine.pdb
-a----       25.01.2019     07:12         187024 CommandLine.xml
-a----       25.01.2019     07:13           4608 ConsoleApp1.exe
-a----       25.01.2019     07:05            189 ConsoleApp1.exe.config
-a----       25.01.2019     07:13          15872 ConsoleApp1.pdb

The change needed is really small as Visual Studio 2017 supports building for multiple target frameworks out of the box. Furthermore all libraries are automatically packed into the NuGet package.

Greetings :-)

Eliminates the need for interfacing libraries reducing the footprint of an application built with the CommandLine library.
@ravenpride
Copy link
Contributor Author

Sorry for the force-push, my business e-mail address evaded ;-)

@ericnewton76
Copy link
Member

Force pushes are okay. Thanks for the contribution. I was actually working towards making this change myself... you beat me to it... ;-)

@ericnewton76 ericnewton76 changed the base branch from master to develop January 27, 2019 17:35
@ericnewton76 ericnewton76 merged commit 0922e48 into commandlineparser:develop Jan 27, 2019
@ravenpride
Copy link
Contributor Author

Thank you :-)

@moh-hassan
Copy link
Collaborator

moh-hassan commented Apr 8, 2019

@ravenpride
There is a solution suggested by the Nuget Team to avoid adding of these dll(s) :
The package should contain the following group

                         <group targetFramework="net45"/>

Have a look to a discussion in sept,2018 posted by me to the Nuget team related to the same problem , with the title:

Why nuget install many dll dependenices in FFW 4.6.1 for the the package CommandLineParser, while only one package is installed in FFW 4.6 and 4.5 #726

and also this discussion.

The nuget team suggestion was:

(in your case CommandLineParser) should contain a group without the netstandard dependencies that specifically targets .NETFramework to avoid unneeded dependencies.

I suggested to modify nuspec file by adding empty dependency group to avoid installing many packages of netstandard15 for net46x projects

So, It's enough to support net45 with netstandard2 to avoid these huge dll(s).

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.

3 participants