internal static Dotnet AddPackageReference(string projectFile, string packageName, string?version = null) { string argString; if (version == null) { argString = ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(new[] { "add", projectFile, "package", packageName }); } else { argString = ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(new[] { "add", projectFile, "package", packageName, "--version", version }); } return(new Dotnet { _info = new ProcessStartInfo("dotnet", argString) { UseShellExecute = false, CreateNoWindow = true, RedirectStandardError = true, RedirectStandardOutput = true } }); }