/// <summary> /// When running on Windows we can't take the commmand line which was provided to the /// Main method of the application. That will go through normal windows command line /// parsing which eliminates artifacts like quotes. This has the effect of normalizing /// the below command line options, which are semantically different, into the same /// value: /// /// /reference:a,b /// /reference:"a,b" /// /// To get the correct semantics here on Windows we parse the original command line /// provided to the process. /// </summary> private static IEnumerable <string> GetCommandLineWindows(IEnumerable <string> args) { IntPtr ptr = Compatibility.GetCommandLine(); if (ptr == IntPtr.Zero) { return(args); } // This memory is owned by the operating system hence we shouldn't (and can't) // free the memory. var commandLine = Marshal.PtrToStringUni(ptr); // The first argument will be the executable name hence we skip it. return(CommandLineParser.SplitCommandLineIntoArguments(commandLine, removeHashComments: false).Skip(1)); }