public static Dotnet AddProjectsToSolution(string solutionFile, IReadOnlyList <string> projects, string solutionFolder = "") { List <string> allArgs = new List <string>() { "sln", solutionFile, "add" }; if (!string.IsNullOrWhiteSpace(solutionFolder)) { allArgs.Add("--solution-folder"); allArgs.Add(solutionFolder); } allArgs.AddRange(projects); string argString = ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(allArgs); return(new Dotnet { _info = new ProcessStartInfo("dotnet", argString) { UseShellExecute = false, CreateNoWindow = true, RedirectStandardError = true, RedirectStandardOutput = true } }); }
public static Dotnet Restore(params string[] args) { return(new Dotnet { _info = new ProcessStartInfo("dotnet", ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(new[] { "restore" }.Concat(args))) { UseShellExecute = false, CreateNoWindow = true, RedirectStandardError = true, RedirectStandardOutput = true } }); }
public static Dotnet AddProjectToProjectReference(string projectFile, params string[] args) { return(new Dotnet { _info = new ProcessStartInfo("dotnet", ArgumentEscaper.EscapeAndConcatenateArgArrayForProcessStart(new[] { "add", projectFile, "reference" }.Concat(args))) { UseShellExecute = false, CreateNoWindow = true, RedirectStandardError = true, RedirectStandardOutput = true } }); }
public 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 } }); }