public static Task <CommandLineResult> ToolInstall(
            this Dotnet dotnet,
            string packageName,
            DirectoryInfo toolPath,
            PackageSource addSource = null,
            Budget budget           = null,
            string version          = null)
        {
            var versionArg = version != null ? $"--version {version}" : "";
            var args       = $@"{packageName} --tool-path ""{toolPath.FullName.RemoveTrailingSlash()}"" {versionArg}";

            if (addSource != null)
            {
                args += $@" --add-source ""{addSource}""";
            }

            return(dotnet.Execute("tool install".AppendArgs(args), budget));
        }
Exemple #2
0
        public static Task <CommandLineResult> ToolInstall(
            this Dotnet dotnet,
            string packageName,
            DirectoryInfo toolPath,
            PackageSource addSource = null,
            Budget budget           = null,
            string version          = null)
        {
            if (string.IsNullOrWhiteSpace(packageName))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(packageName));
            }
            var versionArg = version != null ? $"--version {version}" : "";
            var args       = $@"{packageName} --tool-path ""{toolPath.FullName.RemoveTrailingSlash()}"" {versionArg}";

            if (addSource != null)
            {
                args += $@" --add-source ""{addSource}""";
            }

            return(dotnet.Execute("tool install".AppendArgs(args), budget));
        }