adamabdelhamed / PowerArgs

The ultimate .NET Standard command line argument parser
MIT License
569 stars 56 forks source link

.NET Core support please #99

Closed HamedFathi closed 7 years ago

HamedFathi commented 8 years ago

Can you provide .NET Core support for this awesome library ?

bitbonk commented 8 years ago

Agreed, since the only apps we can currently write with .NET Core are console apps, PowerArgs would be especially useful.

bitbonk commented 7 years ago

Here is the complete list of APIs that PowerArgs uses that most likely still won't be supported in netstandard 2.0. This is pretty much all we need to adress to support netstandard 2.0 and .NET Core vNext.

T:System.CodeDom.Compiler.CodeDomProvider M:System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(System.CodeDom.Compiler.CompilerParameters,System.String[]) T:System.CodeDom.Compiler.CompilerResults M:System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly M:System.CodeDom.Compiler.CompilerResults.get_Errors T:System.CodeDom.Compiler.CompilerParameters M:System.CodeDom.Compiler.CompilerParameters.#ctor M:System.CodeDom.Compiler.CompilerParameters.get_ReferencedAssemblies M:System.CodeDom.Compiler.CompilerParameters.set_GenerateExecutable(System.Boolean) M:System.CodeDom.Compiler.CompilerParameters.set_GenerateInMemory(System.Boolean) T:System.CodeDom.Compiler.CompilerErrorCollection T:Microsoft.CSharp.CSharpCodeProvider M:Microsoft.CSharp.CSharpCodeProvider.#ctor M:System.Type.GetFields M:System.Type.GetGenericArguments M:System.Type.GetInterfaces M:System.Type.GetMethod(System.String) M:System.Type.GetMethod(System.String,System.Type[]) M:System.Type.GetMethods M:System.Type.GetMethods(System.Reflection.BindingFlags) M:System.Type.GetProperties M:System.Type.GetProperties(System.Reflection.BindingFlags) M:System.Type.GetProperty(System.String) M:System.Type.GetProperty(System.String,System.Reflection.BindingFlags) M:System.Runtime.InteropServices.Marshal.SecureStringToGlobalAllocUnicode(System.Security.SecureString)

adamabdelhamed commented 7 years ago

The reflection APIs are core to PowerArgs. Any ideas for a strategy to make this happen? I can't think of anything. I'll close this soon if nobody (including myself) don't come up with any bright ideas.

-edited typos from my mobile reply

nemec commented 7 years ago

FYI the reflection methods are available in Core under the new class System.Reflection.TypeInfo, which can be retrieved by calling the [extension, I think] method type.GetTypeInfo().

At least, it's supported in earlier versions of Core so I think it will still be available in 2.0.

I think CodeDom has been replaced by Roslyn APIs. SecureString exists but looks to be more or less a no-op in Linux (i.e. not secure)

NickStrupat commented 7 years ago

@nemec SecureString on Unix doesn't encrypt its data but it does the most important work of preventing GC from moving the string around and zeroing-out the memory on dispose.

adamabdelhamed commented 7 years ago

I got this working and ran some sample apps on Linux. But I don't want to check in the hacked up version I put together to get the prototype working. I think I'll wait until the next version of the .net tooling comes out. That way, I can build a .NET standard 1.6 dll that will work on Core and on .net 4.6.1.

This is going to be cool though. You'll be able to run just about all of PowerArgs, including the fancy stuff in the PowerArgs.Cli namespace that I haven't documented yet on Linux and Mac. When this happens, I'll likely bump the version to 3.0 and document all the new features.

adamabdelhamed commented 7 years ago

Supported in version 3.0