Ejemplo n.º 1
0
        internal static Dotnet AddProjectsToSolution(string solutionFile, IReadOnlyList <string> projects, string?solutionFolder = null)
        {
            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
                }
            });
        }
Ejemplo n.º 2
0
 internal 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
         }
     });
 }
Ejemplo n.º 3
0
 internal 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
         }
     });
 }
Ejemplo n.º 4
0
        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
                }
            });
        }