diff --git a/Build/Program.cs b/Build/Program.cs index 3bf17f3..7ce348c 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -191,7 +191,16 @@ Environment.SetEnvironmentVariable("PATH", pathEnvVar); } -var installTool = new DotNetCustom("tool", "install", toolPackageId, "-g", "--version", packageVersion.ToString(), "--add-source", Path.Combine(outputDir, "CSharpInteractive.Tool")) +await new DotNetBuild() + .WithProject(Path.Combine("Samples", "MySampleLib")) + .WithShortName($"Building sample") + .BuildAsync().EnsureSuccess(); + +var installTool = new DotNetToolInstall() + .WithPackage(toolPackageId) + .WithGlobal(true) + .WithVersion(packageVersion.ToString()) + .AddSources(Path.Combine(outputDir, "CSharpInteractive.Tool")) .WithShortName("Installing tool"); installTool.Run(output => @@ -202,7 +211,8 @@ new DotNetCustom("csi", "/?").WithShortName("Checking tool").Run().EnsureSuccess(); -var uninstallTemplates = new DotNetCustom("new", "uninstall", templatesPackageId) +var uninstallTemplates = new DotNetNewUninstall() + .WithPackage(templatesPackageId) .WithShortName("Uninstalling template"); uninstallTemplates.Run(output => @@ -211,7 +221,9 @@ WriteLine(output.Line); }).EnsureSuccess(_ => true); -var installTemplates = new DotNetCustom("new", "install", $"{templatesPackageId}::{packageVersion.ToString()}", "--nuget-source", templateOutputDir) +var installTemplates = new DotNetNewInstall() + .WithPackage($"{templatesPackageId}::{packageVersion.ToString()}") + .AddSources(templateOutputDir) .WithShortName("Installing template"); installTemplates.WithShortName(installTemplates.ShortName).Run().EnsureSuccess(); @@ -222,7 +234,7 @@ if (!string.IsNullOrWhiteSpace(apiKey) && packageVersion.Release != "dev" && packageVersion.Release != "dev") { - var push = new DotNetNuGetPush().WithApiKey(apiKey).WithSources(defaultNuGetSource); + var push = new DotNetNuGetPush().WithApiKey(apiKey).WithSource(defaultNuGetSource); foreach (var package in packages.Where(i => i.Publish)) { push.WithPackage(package.Package) @@ -269,7 +281,10 @@ async Task CheckCompatibilityAsync( try { var sampleProjectDir = Path.Combine("Samples", "MySampleLib", "MySampleLib.Tests"); - await new DotNetNew("build", $"--version={nuGetVersion}", "-T", framework, "--no-restore") + await new DotNetNew() + .WithTemplateName("build") + .WithNoRestore(true) + .WithArgs($"--version={nuGetVersion}", "-T", framework) .WithWorkingDirectory(buildProjectDir) .WithShortName($"Creating a new {sampleProjectName}") .RunAsync().EnsureSuccess(); @@ -281,9 +296,10 @@ async Task CheckCompatibilityAsync( .BuildAsync().EnsureSuccess(); await new DotNetRun() - .WithProject(buildProjectDir) + .WithWorkingDirectory(buildProjectDir) + .WithNoRestore(true) .WithNoBuild(true) - .WithWorkingDirectory(sampleProjectDir) + .WithFramework(framework) .WithShortName($"Running a build for the {sampleProjectName}") .RunAsync().EnsureSuccess(); diff --git a/CSharpInteractive.HostApi/CSharpInteractive.HostApi.csproj b/CSharpInteractive.HostApi/CSharpInteractive.HostApi.csproj index 3f9f4ec..0ef20de 100644 --- a/CSharpInteractive.HostApi/CSharpInteractive.HostApi.csproj +++ b/CSharpInteractive.HostApi/CSharpInteractive.HostApi.csproj @@ -30,15 +30,20 @@ - True True + True CommandLines.tt - + + DotNetCommands.cs + TextTemplatingFileGenerator + + + True True - CommandLines.tt + DotNetCommands.tt diff --git a/CSharpInteractive.HostApi/CommandLines.cs b/CSharpInteractive.HostApi/CommandLines.cs index b255a3f..85c9a0a 100644 --- a/CSharpInteractive.HostApi/CommandLines.cs +++ b/CSharpInteractive.HostApi/CommandLines.cs @@ -1,6 +1,6 @@ // ReSharper disable InconsistentNaming namespace HostApi; - + [ExcludeFromCodeCoverage] public partial record CommandLine: ICommandLine { @@ -70,7 +70,7 @@ public partial record CommandLine: ICommandLine } [ExcludeFromCodeCoverage] -public partial record DotNetBuild: ICommandLine +public partial record DotNetCustom: ICommandLine { /// /// Appends an argument. @@ -78,7 +78,7 @@ public partial record DotNetBuild: ICommandLine /// The command to which an argument will be added. /// Argument to add. /// Returns a new command with the corresponding changes. - public static DotNetBuild operator +(DotNetBuild command, string arg) => command.AddArgs(arg); + public static DotNetCustom operator +(DotNetCustom command, string arg) => command.AddArgs(arg); /// /// Removes an argument by its name. @@ -86,7 +86,7 @@ public partial record DotNetBuild: ICommandLine /// The command to which an argument will be removed. /// Argument to remove. /// Returns a new command with the corresponding changes. - public static DotNetBuild operator -(DotNetBuild command, string arg) => command.RemoveArgs(arg); + public static DotNetCustom operator -(DotNetCustom command, string arg) => command.RemoveArgs(arg); /// /// Appends arguments. @@ -94,7 +94,7 @@ public partial record DotNetBuild: ICommandLine /// The command to which arguments will be added. /// Arguments to add. /// Returns a new command with the corresponding changes. - public static DotNetBuild operator +(DotNetBuild command, IEnumerable args) => command.AddArgs(args); + public static DotNetCustom operator +(DotNetCustom command, IEnumerable args) => command.AddArgs(args); /// /// Removes arguments by their name. @@ -102,7 +102,7 @@ public partial record DotNetBuild: ICommandLine /// The command to which arguments will be removed. /// Arguments to remove. /// Returns a new command with the corresponding changes. - public static DotNetBuild operator -(DotNetBuild command, IEnumerable args) => command.RemoveArgs(args); + public static DotNetCustom operator -(DotNetCustom command, IEnumerable args) => command.RemoveArgs(args); /// /// Appends an environment variable. @@ -110,7 +110,7 @@ public partial record DotNetBuild: ICommandLine /// The command to which an environment variable will be added. /// Environment variable to add. /// Returns a new command with the corresponding changes. - public static DotNetBuild operator +(DotNetBuild command, (string name, string value) var) => command.AddVars(var); + public static DotNetCustom operator +(DotNetCustom command, (string name, string value) var) => command.AddVars(var); /// /// Removes environment variable by its name and value. @@ -118,7 +118,7 @@ public partial record DotNetBuild: ICommandLine /// The command to which an environment variable will be removed. /// Environment variable to remove. /// Returns a new command with the corresponding changes. - public static DotNetBuild operator -(DotNetBuild command, (string name, string value) var) => command.RemoveVars(var); + public static DotNetCustom operator -(DotNetCustom command, (string name, string value) var) => command.RemoveVars(var); /// /// Appends environment variables. @@ -126,7 +126,7 @@ public partial record DotNetBuild: ICommandLine /// The command to which environment variables will be added. /// Environment variables to add. /// Returns a new command with the corresponding changes. - public static DotNetBuild operator +(DotNetBuild command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + public static DotNetCustom operator +(DotNetCustom command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); /// /// Removes environment variables by their name and value. @@ -134,11 +134,11 @@ public partial record DotNetBuild: ICommandLine /// The command to which environment variables will be removed. /// environment variables to remove. /// Returns a new command with the corresponding changes. - public static DotNetBuild operator -(DotNetBuild command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); + public static DotNetCustom operator -(DotNetCustom command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); } [ExcludeFromCodeCoverage] -public partial record DotNetBuildServerShutdown: ICommandLine +public partial record DotNet: ICommandLine { /// /// Appends an argument. @@ -146,7 +146,7 @@ public partial record DotNetBuildServerShutdown: ICommandLine /// The command to which an argument will be added. /// Argument to add. /// Returns a new command with the corresponding changes. - public static DotNetBuildServerShutdown operator +(DotNetBuildServerShutdown command, string arg) => command.AddArgs(arg); + public static DotNet operator +(DotNet command, string arg) => command.AddArgs(arg); /// /// Removes an argument by its name. @@ -154,7 +154,7 @@ public partial record DotNetBuildServerShutdown: ICommandLine /// The command to which an argument will be removed. /// Argument to remove. /// Returns a new command with the corresponding changes. - public static DotNetBuildServerShutdown operator -(DotNetBuildServerShutdown command, string arg) => command.RemoveArgs(arg); + public static DotNet operator -(DotNet command, string arg) => command.RemoveArgs(arg); /// /// Appends arguments. @@ -162,7 +162,7 @@ public partial record DotNetBuildServerShutdown: ICommandLine /// The command to which arguments will be added. /// Arguments to add. /// Returns a new command with the corresponding changes. - public static DotNetBuildServerShutdown operator +(DotNetBuildServerShutdown command, IEnumerable args) => command.AddArgs(args); + public static DotNet operator +(DotNet command, IEnumerable args) => command.AddArgs(args); /// /// Removes arguments by their name. @@ -170,7 +170,7 @@ public partial record DotNetBuildServerShutdown: ICommandLine /// The command to which arguments will be removed. /// Arguments to remove. /// Returns a new command with the corresponding changes. - public static DotNetBuildServerShutdown operator -(DotNetBuildServerShutdown command, IEnumerable args) => command.RemoveArgs(args); + public static DotNet operator -(DotNet command, IEnumerable args) => command.RemoveArgs(args); /// /// Appends an environment variable. @@ -178,7 +178,7 @@ public partial record DotNetBuildServerShutdown: ICommandLine /// The command to which an environment variable will be added. /// Environment variable to add. /// Returns a new command with the corresponding changes. - public static DotNetBuildServerShutdown operator +(DotNetBuildServerShutdown command, (string name, string value) var) => command.AddVars(var); + public static DotNet operator +(DotNet command, (string name, string value) var) => command.AddVars(var); /// /// Removes environment variable by its name and value. @@ -186,7 +186,7 @@ public partial record DotNetBuildServerShutdown: ICommandLine /// The command to which an environment variable will be removed. /// Environment variable to remove. /// Returns a new command with the corresponding changes. - public static DotNetBuildServerShutdown operator -(DotNetBuildServerShutdown command, (string name, string value) var) => command.RemoveVars(var); + public static DotNet operator -(DotNet command, (string name, string value) var) => command.RemoveVars(var); /// /// Appends environment variables. @@ -194,7 +194,7 @@ public partial record DotNetBuildServerShutdown: ICommandLine /// The command to which environment variables will be added. /// Environment variables to add. /// Returns a new command with the corresponding changes. - public static DotNetBuildServerShutdown operator +(DotNetBuildServerShutdown command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + public static DotNet operator +(DotNet command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); /// /// Removes environment variables by their name and value. @@ -202,11 +202,11 @@ public partial record DotNetBuildServerShutdown: ICommandLine /// The command to which environment variables will be removed. /// environment variables to remove. /// Returns a new command with the corresponding changes. - public static DotNetBuildServerShutdown operator -(DotNetBuildServerShutdown command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); + public static DotNet operator -(DotNet command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); } [ExcludeFromCodeCoverage] -public partial record DotNetClean: ICommandLine +public partial record DotNetExec: ICommandLine { /// /// Appends an argument. @@ -214,7 +214,7 @@ public partial record DotNetClean: ICommandLine /// The command to which an argument will be added. /// Argument to add. /// Returns a new command with the corresponding changes. - public static DotNetClean operator +(DotNetClean command, string arg) => command.AddArgs(arg); + public static DotNetExec operator +(DotNetExec command, string arg) => command.AddArgs(arg); /// /// Removes an argument by its name. @@ -222,7 +222,7 @@ public partial record DotNetClean: ICommandLine /// The command to which an argument will be removed. /// Argument to remove. /// Returns a new command with the corresponding changes. - public static DotNetClean operator -(DotNetClean command, string arg) => command.RemoveArgs(arg); + public static DotNetExec operator -(DotNetExec command, string arg) => command.RemoveArgs(arg); /// /// Appends arguments. @@ -230,7 +230,7 @@ public partial record DotNetClean: ICommandLine /// The command to which arguments will be added. /// Arguments to add. /// Returns a new command with the corresponding changes. - public static DotNetClean operator +(DotNetClean command, IEnumerable args) => command.AddArgs(args); + public static DotNetExec operator +(DotNetExec command, IEnumerable args) => command.AddArgs(args); /// /// Removes arguments by their name. @@ -238,7 +238,7 @@ public partial record DotNetClean: ICommandLine /// The command to which arguments will be removed. /// Arguments to remove. /// Returns a new command with the corresponding changes. - public static DotNetClean operator -(DotNetClean command, IEnumerable args) => command.RemoveArgs(args); + public static DotNetExec operator -(DotNetExec command, IEnumerable args) => command.RemoveArgs(args); /// /// Appends an environment variable. @@ -246,7 +246,7 @@ public partial record DotNetClean: ICommandLine /// The command to which an environment variable will be added. /// Environment variable to add. /// Returns a new command with the corresponding changes. - public static DotNetClean operator +(DotNetClean command, (string name, string value) var) => command.AddVars(var); + public static DotNetExec operator +(DotNetExec command, (string name, string value) var) => command.AddVars(var); /// /// Removes environment variable by its name and value. @@ -254,7 +254,7 @@ public partial record DotNetClean: ICommandLine /// The command to which an environment variable will be removed. /// Environment variable to remove. /// Returns a new command with the corresponding changes. - public static DotNetClean operator -(DotNetClean command, (string name, string value) var) => command.RemoveVars(var); + public static DotNetExec operator -(DotNetExec command, (string name, string value) var) => command.RemoveVars(var); /// /// Appends environment variables. @@ -262,7 +262,7 @@ public partial record DotNetClean: ICommandLine /// The command to which environment variables will be added. /// Environment variables to add. /// Returns a new command with the corresponding changes. - public static DotNetClean operator +(DotNetClean command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + public static DotNetExec operator +(DotNetExec command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); /// /// Removes environment variables by their name and value. @@ -270,11 +270,11 @@ public partial record DotNetClean: ICommandLine /// The command to which environment variables will be removed. /// environment variables to remove. /// Returns a new command with the corresponding changes. - public static DotNetClean operator -(DotNetClean command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); + public static DotNetExec operator -(DotNetExec command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); } [ExcludeFromCodeCoverage] -public partial record DotNetCustom: ICommandLine +public partial record DotNetAddPackage: ICommandLine { /// /// Appends an argument. @@ -282,7 +282,7 @@ public partial record DotNetCustom: ICommandLine /// The command to which an argument will be added. /// Argument to add. /// Returns a new command with the corresponding changes. - public static DotNetCustom operator +(DotNetCustom command, string arg) => command.AddArgs(arg); + public static DotNetAddPackage operator +(DotNetAddPackage command, string arg) => command.AddArgs(arg); /// /// Removes an argument by its name. @@ -290,7 +290,7 @@ public partial record DotNetCustom: ICommandLine /// The command to which an argument will be removed. /// Argument to remove. /// Returns a new command with the corresponding changes. - public static DotNetCustom operator -(DotNetCustom command, string arg) => command.RemoveArgs(arg); + public static DotNetAddPackage operator -(DotNetAddPackage command, string arg) => command.RemoveArgs(arg); /// /// Appends arguments. @@ -298,7 +298,7 @@ public partial record DotNetCustom: ICommandLine /// The command to which arguments will be added. /// Arguments to add. /// Returns a new command with the corresponding changes. - public static DotNetCustom operator +(DotNetCustom command, IEnumerable args) => command.AddArgs(args); + public static DotNetAddPackage operator +(DotNetAddPackage command, IEnumerable args) => command.AddArgs(args); /// /// Removes arguments by their name. @@ -306,7 +306,7 @@ public partial record DotNetCustom: ICommandLine /// The command to which arguments will be removed. /// Arguments to remove. /// Returns a new command with the corresponding changes. - public static DotNetCustom operator -(DotNetCustom command, IEnumerable args) => command.RemoveArgs(args); + public static DotNetAddPackage operator -(DotNetAddPackage command, IEnumerable args) => command.RemoveArgs(args); /// /// Appends an environment variable. @@ -314,7 +314,7 @@ public partial record DotNetCustom: ICommandLine /// The command to which an environment variable will be added. /// Environment variable to add. /// Returns a new command with the corresponding changes. - public static DotNetCustom operator +(DotNetCustom command, (string name, string value) var) => command.AddVars(var); + public static DotNetAddPackage operator +(DotNetAddPackage command, (string name, string value) var) => command.AddVars(var); /// /// Removes environment variable by its name and value. @@ -322,7 +322,7 @@ public partial record DotNetCustom: ICommandLine /// The command to which an environment variable will be removed. /// Environment variable to remove. /// Returns a new command with the corresponding changes. - public static DotNetCustom operator -(DotNetCustom command, (string name, string value) var) => command.RemoveVars(var); + public static DotNetAddPackage operator -(DotNetAddPackage command, (string name, string value) var) => command.RemoveVars(var); /// /// Appends environment variables. @@ -330,7 +330,7 @@ public partial record DotNetCustom: ICommandLine /// The command to which environment variables will be added. /// Environment variables to add. /// Returns a new command with the corresponding changes. - public static DotNetCustom operator +(DotNetCustom command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + public static DotNetAddPackage operator +(DotNetAddPackage command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); /// /// Removes environment variables by their name and value. @@ -338,11 +338,11 @@ public partial record DotNetCustom: ICommandLine /// The command to which environment variables will be removed. /// environment variables to remove. /// Returns a new command with the corresponding changes. - public static DotNetCustom operator -(DotNetCustom command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); + public static DotNetAddPackage operator -(DotNetAddPackage command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); } [ExcludeFromCodeCoverage] -public partial record DotNetNew: ICommandLine +public partial record DotNetListPackage: ICommandLine { /// /// Appends an argument. @@ -350,7 +350,7 @@ public partial record DotNetNew: ICommandLine /// The command to which an argument will be added. /// Argument to add. /// Returns a new command with the corresponding changes. - public static DotNetNew operator +(DotNetNew command, string arg) => command.AddArgs(arg); + public static DotNetListPackage operator +(DotNetListPackage command, string arg) => command.AddArgs(arg); /// /// Removes an argument by its name. @@ -358,7 +358,7 @@ public partial record DotNetNew: ICommandLine /// The command to which an argument will be removed. /// Argument to remove. /// Returns a new command with the corresponding changes. - public static DotNetNew operator -(DotNetNew command, string arg) => command.RemoveArgs(arg); + public static DotNetListPackage operator -(DotNetListPackage command, string arg) => command.RemoveArgs(arg); /// /// Appends arguments. @@ -366,7 +366,7 @@ public partial record DotNetNew: ICommandLine /// The command to which arguments will be added. /// Arguments to add. /// Returns a new command with the corresponding changes. - public static DotNetNew operator +(DotNetNew command, IEnumerable args) => command.AddArgs(args); + public static DotNetListPackage operator +(DotNetListPackage command, IEnumerable args) => command.AddArgs(args); /// /// Removes arguments by their name. @@ -374,7 +374,7 @@ public partial record DotNetNew: ICommandLine /// The command to which arguments will be removed. /// Arguments to remove. /// Returns a new command with the corresponding changes. - public static DotNetNew operator -(DotNetNew command, IEnumerable args) => command.RemoveArgs(args); + public static DotNetListPackage operator -(DotNetListPackage command, IEnumerable args) => command.RemoveArgs(args); /// /// Appends an environment variable. @@ -382,7 +382,7 @@ public partial record DotNetNew: ICommandLine /// The command to which an environment variable will be added. /// Environment variable to add. /// Returns a new command with the corresponding changes. - public static DotNetNew operator +(DotNetNew command, (string name, string value) var) => command.AddVars(var); + public static DotNetListPackage operator +(DotNetListPackage command, (string name, string value) var) => command.AddVars(var); /// /// Removes environment variable by its name and value. @@ -390,7 +390,7 @@ public partial record DotNetNew: ICommandLine /// The command to which an environment variable will be removed. /// Environment variable to remove. /// Returns a new command with the corresponding changes. - public static DotNetNew operator -(DotNetNew command, (string name, string value) var) => command.RemoveVars(var); + public static DotNetListPackage operator -(DotNetListPackage command, (string name, string value) var) => command.RemoveVars(var); /// /// Appends environment variables. @@ -398,7 +398,7 @@ public partial record DotNetNew: ICommandLine /// The command to which environment variables will be added. /// Environment variables to add. /// Returns a new command with the corresponding changes. - public static DotNetNew operator +(DotNetNew command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + public static DotNetListPackage operator +(DotNetListPackage command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); /// /// Removes environment variables by their name and value. @@ -406,11 +406,11 @@ public partial record DotNetNew: ICommandLine /// The command to which environment variables will be removed. /// environment variables to remove. /// Returns a new command with the corresponding changes. - public static DotNetNew operator -(DotNetNew command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); + public static DotNetListPackage operator -(DotNetListPackage command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); } [ExcludeFromCodeCoverage] -public partial record DotNetNuGetPush: ICommandLine +public partial record DotNetRemovePackage: ICommandLine { /// /// Appends an argument. @@ -418,7 +418,7 @@ public partial record DotNetNuGetPush: ICommandLine /// The command to which an argument will be added. /// Argument to add. /// Returns a new command with the corresponding changes. - public static DotNetNuGetPush operator +(DotNetNuGetPush command, string arg) => command.AddArgs(arg); + public static DotNetRemovePackage operator +(DotNetRemovePackage command, string arg) => command.AddArgs(arg); /// /// Removes an argument by its name. @@ -426,7 +426,7 @@ public partial record DotNetNuGetPush: ICommandLine /// The command to which an argument will be removed. /// Argument to remove. /// Returns a new command with the corresponding changes. - public static DotNetNuGetPush operator -(DotNetNuGetPush command, string arg) => command.RemoveArgs(arg); + public static DotNetRemovePackage operator -(DotNetRemovePackage command, string arg) => command.RemoveArgs(arg); /// /// Appends arguments. @@ -434,7 +434,7 @@ public partial record DotNetNuGetPush: ICommandLine /// The command to which arguments will be added. /// Arguments to add. /// Returns a new command with the corresponding changes. - public static DotNetNuGetPush operator +(DotNetNuGetPush command, IEnumerable args) => command.AddArgs(args); + public static DotNetRemovePackage operator +(DotNetRemovePackage command, IEnumerable args) => command.AddArgs(args); /// /// Removes arguments by their name. @@ -442,7 +442,7 @@ public partial record DotNetNuGetPush: ICommandLine /// The command to which arguments will be removed. /// Arguments to remove. /// Returns a new command with the corresponding changes. - public static DotNetNuGetPush operator -(DotNetNuGetPush command, IEnumerable args) => command.RemoveArgs(args); + public static DotNetRemovePackage operator -(DotNetRemovePackage command, IEnumerable args) => command.RemoveArgs(args); /// /// Appends an environment variable. @@ -450,7 +450,7 @@ public partial record DotNetNuGetPush: ICommandLine /// The command to which an environment variable will be added. /// Environment variable to add. /// Returns a new command with the corresponding changes. - public static DotNetNuGetPush operator +(DotNetNuGetPush command, (string name, string value) var) => command.AddVars(var); + public static DotNetRemovePackage operator +(DotNetRemovePackage command, (string name, string value) var) => command.AddVars(var); /// /// Removes environment variable by its name and value. @@ -458,7 +458,7 @@ public partial record DotNetNuGetPush: ICommandLine /// The command to which an environment variable will be removed. /// Environment variable to remove. /// Returns a new command with the corresponding changes. - public static DotNetNuGetPush operator -(DotNetNuGetPush command, (string name, string value) var) => command.RemoveVars(var); + public static DotNetRemovePackage operator -(DotNetRemovePackage command, (string name, string value) var) => command.RemoveVars(var); /// /// Appends environment variables. @@ -466,7 +466,7 @@ public partial record DotNetNuGetPush: ICommandLine /// The command to which environment variables will be added. /// Environment variables to add. /// Returns a new command with the corresponding changes. - public static DotNetNuGetPush operator +(DotNetNuGetPush command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + public static DotNetRemovePackage operator +(DotNetRemovePackage command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); /// /// Removes environment variables by their name and value. @@ -474,11 +474,11 @@ public partial record DotNetNuGetPush: ICommandLine /// The command to which environment variables will be removed. /// environment variables to remove. /// Returns a new command with the corresponding changes. - public static DotNetNuGetPush operator -(DotNetNuGetPush command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); + public static DotNetRemovePackage operator -(DotNetRemovePackage command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); } [ExcludeFromCodeCoverage] -public partial record DotNetPack: ICommandLine +public partial record DotNetAddReference: ICommandLine { /// /// Appends an argument. @@ -486,7 +486,7 @@ public partial record DotNetPack: ICommandLine /// The command to which an argument will be added. /// Argument to add. /// Returns a new command with the corresponding changes. - public static DotNetPack operator +(DotNetPack command, string arg) => command.AddArgs(arg); + public static DotNetAddReference operator +(DotNetAddReference command, string arg) => command.AddArgs(arg); /// /// Removes an argument by its name. @@ -494,7 +494,7 @@ public partial record DotNetPack: ICommandLine /// The command to which an argument will be removed. /// Argument to remove. /// Returns a new command with the corresponding changes. - public static DotNetPack operator -(DotNetPack command, string arg) => command.RemoveArgs(arg); + public static DotNetAddReference operator -(DotNetAddReference command, string arg) => command.RemoveArgs(arg); /// /// Appends arguments. @@ -502,7 +502,7 @@ public partial record DotNetPack: ICommandLine /// The command to which arguments will be added. /// Arguments to add. /// Returns a new command with the corresponding changes. - public static DotNetPack operator +(DotNetPack command, IEnumerable args) => command.AddArgs(args); + public static DotNetAddReference operator +(DotNetAddReference command, IEnumerable args) => command.AddArgs(args); /// /// Removes arguments by their name. @@ -510,7 +510,7 @@ public partial record DotNetPack: ICommandLine /// The command to which arguments will be removed. /// Arguments to remove. /// Returns a new command with the corresponding changes. - public static DotNetPack operator -(DotNetPack command, IEnumerable args) => command.RemoveArgs(args); + public static DotNetAddReference operator -(DotNetAddReference command, IEnumerable args) => command.RemoveArgs(args); /// /// Appends an environment variable. @@ -518,7 +518,7 @@ public partial record DotNetPack: ICommandLine /// The command to which an environment variable will be added. /// Environment variable to add. /// Returns a new command with the corresponding changes. - public static DotNetPack operator +(DotNetPack command, (string name, string value) var) => command.AddVars(var); + public static DotNetAddReference operator +(DotNetAddReference command, (string name, string value) var) => command.AddVars(var); /// /// Removes environment variable by its name and value. @@ -526,7 +526,7 @@ public partial record DotNetPack: ICommandLine /// The command to which an environment variable will be removed. /// Environment variable to remove. /// Returns a new command with the corresponding changes. - public static DotNetPack operator -(DotNetPack command, (string name, string value) var) => command.RemoveVars(var); + public static DotNetAddReference operator -(DotNetAddReference command, (string name, string value) var) => command.RemoveVars(var); /// /// Appends environment variables. @@ -534,7 +534,7 @@ public partial record DotNetPack: ICommandLine /// The command to which environment variables will be added. /// Environment variables to add. /// Returns a new command with the corresponding changes. - public static DotNetPack operator +(DotNetPack command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + public static DotNetAddReference operator +(DotNetAddReference command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); /// /// Removes environment variables by their name and value. @@ -542,11 +542,11 @@ public partial record DotNetPack: ICommandLine /// The command to which environment variables will be removed. /// environment variables to remove. /// Returns a new command with the corresponding changes. - public static DotNetPack operator -(DotNetPack command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); + public static DotNetAddReference operator -(DotNetAddReference command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); } [ExcludeFromCodeCoverage] -public partial record DotNetPublish: ICommandLine +public partial record DotNetListReference: ICommandLine { /// /// Appends an argument. @@ -554,7 +554,7 @@ public partial record DotNetPublish: ICommandLine /// The command to which an argument will be added. /// Argument to add. /// Returns a new command with the corresponding changes. - public static DotNetPublish operator +(DotNetPublish command, string arg) => command.AddArgs(arg); + public static DotNetListReference operator +(DotNetListReference command, string arg) => command.AddArgs(arg); /// /// Removes an argument by its name. @@ -562,7 +562,7 @@ public partial record DotNetPublish: ICommandLine /// The command to which an argument will be removed. /// Argument to remove. /// Returns a new command with the corresponding changes. - public static DotNetPublish operator -(DotNetPublish command, string arg) => command.RemoveArgs(arg); + public static DotNetListReference operator -(DotNetListReference command, string arg) => command.RemoveArgs(arg); /// /// Appends arguments. @@ -570,7 +570,7 @@ public partial record DotNetPublish: ICommandLine /// The command to which arguments will be added. /// Arguments to add. /// Returns a new command with the corresponding changes. - public static DotNetPublish operator +(DotNetPublish command, IEnumerable args) => command.AddArgs(args); + public static DotNetListReference operator +(DotNetListReference command, IEnumerable args) => command.AddArgs(args); /// /// Removes arguments by their name. @@ -578,7 +578,7 @@ public partial record DotNetPublish: ICommandLine /// The command to which arguments will be removed. /// Arguments to remove. /// Returns a new command with the corresponding changes. - public static DotNetPublish operator -(DotNetPublish command, IEnumerable args) => command.RemoveArgs(args); + public static DotNetListReference operator -(DotNetListReference command, IEnumerable args) => command.RemoveArgs(args); /// /// Appends an environment variable. @@ -586,7 +586,7 @@ public partial record DotNetPublish: ICommandLine /// The command to which an environment variable will be added. /// Environment variable to add. /// Returns a new command with the corresponding changes. - public static DotNetPublish operator +(DotNetPublish command, (string name, string value) var) => command.AddVars(var); + public static DotNetListReference operator +(DotNetListReference command, (string name, string value) var) => command.AddVars(var); /// /// Removes environment variable by its name and value. @@ -594,7 +594,7 @@ public partial record DotNetPublish: ICommandLine /// The command to which an environment variable will be removed. /// Environment variable to remove. /// Returns a new command with the corresponding changes. - public static DotNetPublish operator -(DotNetPublish command, (string name, string value) var) => command.RemoveVars(var); + public static DotNetListReference operator -(DotNetListReference command, (string name, string value) var) => command.RemoveVars(var); /// /// Appends environment variables. @@ -602,7 +602,7 @@ public partial record DotNetPublish: ICommandLine /// The command to which environment variables will be added. /// Environment variables to add. /// Returns a new command with the corresponding changes. - public static DotNetPublish operator +(DotNetPublish command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + public static DotNetListReference operator +(DotNetListReference command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); /// /// Removes environment variables by their name and value. @@ -610,11 +610,11 @@ public partial record DotNetPublish: ICommandLine /// The command to which environment variables will be removed. /// environment variables to remove. /// Returns a new command with the corresponding changes. - public static DotNetPublish operator -(DotNetPublish command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); + public static DotNetListReference operator -(DotNetListReference command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); } [ExcludeFromCodeCoverage] -public partial record DotNetRestore: ICommandLine +public partial record DotNetRemoveReference: ICommandLine { /// /// Appends an argument. @@ -622,7 +622,7 @@ public partial record DotNetRestore: ICommandLine /// The command to which an argument will be added. /// Argument to add. /// Returns a new command with the corresponding changes. - public static DotNetRestore operator +(DotNetRestore command, string arg) => command.AddArgs(arg); + public static DotNetRemoveReference operator +(DotNetRemoveReference command, string arg) => command.AddArgs(arg); /// /// Removes an argument by its name. @@ -630,7 +630,7 @@ public partial record DotNetRestore: ICommandLine /// The command to which an argument will be removed. /// Argument to remove. /// Returns a new command with the corresponding changes. - public static DotNetRestore operator -(DotNetRestore command, string arg) => command.RemoveArgs(arg); + public static DotNetRemoveReference operator -(DotNetRemoveReference command, string arg) => command.RemoveArgs(arg); /// /// Appends arguments. @@ -638,7 +638,7 @@ public partial record DotNetRestore: ICommandLine /// The command to which arguments will be added. /// Arguments to add. /// Returns a new command with the corresponding changes. - public static DotNetRestore operator +(DotNetRestore command, IEnumerable args) => command.AddArgs(args); + public static DotNetRemoveReference operator +(DotNetRemoveReference command, IEnumerable args) => command.AddArgs(args); /// /// Removes arguments by their name. @@ -646,7 +646,7 @@ public partial record DotNetRestore: ICommandLine /// The command to which arguments will be removed. /// Arguments to remove. /// Returns a new command with the corresponding changes. - public static DotNetRestore operator -(DotNetRestore command, IEnumerable args) => command.RemoveArgs(args); + public static DotNetRemoveReference operator -(DotNetRemoveReference command, IEnumerable args) => command.RemoveArgs(args); /// /// Appends an environment variable. @@ -654,7 +654,7 @@ public partial record DotNetRestore: ICommandLine /// The command to which an environment variable will be added. /// Environment variable to add. /// Returns a new command with the corresponding changes. - public static DotNetRestore operator +(DotNetRestore command, (string name, string value) var) => command.AddVars(var); + public static DotNetRemoveReference operator +(DotNetRemoveReference command, (string name, string value) var) => command.AddVars(var); /// /// Removes environment variable by its name and value. @@ -662,7 +662,7 @@ public partial record DotNetRestore: ICommandLine /// The command to which an environment variable will be removed. /// Environment variable to remove. /// Returns a new command with the corresponding changes. - public static DotNetRestore operator -(DotNetRestore command, (string name, string value) var) => command.RemoveVars(var); + public static DotNetRemoveReference operator -(DotNetRemoveReference command, (string name, string value) var) => command.RemoveVars(var); /// /// Appends environment variables. @@ -670,7 +670,7 @@ public partial record DotNetRestore: ICommandLine /// The command to which environment variables will be added. /// Environment variables to add. /// Returns a new command with the corresponding changes. - public static DotNetRestore operator +(DotNetRestore command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + public static DotNetRemoveReference operator +(DotNetRemoveReference command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); /// /// Removes environment variables by their name and value. @@ -678,11 +678,11 @@ public partial record DotNetRestore: ICommandLine /// The command to which environment variables will be removed. /// environment variables to remove. /// Returns a new command with the corresponding changes. - public static DotNetRestore operator -(DotNetRestore command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); + public static DotNetRemoveReference operator -(DotNetRemoveReference command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); } [ExcludeFromCodeCoverage] -public partial record DotNetRun: ICommandLine +public partial record DotNetBuild: ICommandLine { /// /// Appends an argument. @@ -690,7 +690,7 @@ public partial record DotNetRun: ICommandLine /// The command to which an argument will be added. /// Argument to add. /// Returns a new command with the corresponding changes. - public static DotNetRun operator +(DotNetRun command, string arg) => command.AddArgs(arg); + public static DotNetBuild operator +(DotNetBuild command, string arg) => command.AddArgs(arg); /// /// Removes an argument by its name. @@ -698,7 +698,7 @@ public partial record DotNetRun: ICommandLine /// The command to which an argument will be removed. /// Argument to remove. /// Returns a new command with the corresponding changes. - public static DotNetRun operator -(DotNetRun command, string arg) => command.RemoveArgs(arg); + public static DotNetBuild operator -(DotNetBuild command, string arg) => command.RemoveArgs(arg); /// /// Appends arguments. @@ -706,7 +706,7 @@ public partial record DotNetRun: ICommandLine /// The command to which arguments will be added. /// Arguments to add. /// Returns a new command with the corresponding changes. - public static DotNetRun operator +(DotNetRun command, IEnumerable args) => command.AddArgs(args); + public static DotNetBuild operator +(DotNetBuild command, IEnumerable args) => command.AddArgs(args); /// /// Removes arguments by their name. @@ -714,7 +714,7 @@ public partial record DotNetRun: ICommandLine /// The command to which arguments will be removed. /// Arguments to remove. /// Returns a new command with the corresponding changes. - public static DotNetRun operator -(DotNetRun command, IEnumerable args) => command.RemoveArgs(args); + public static DotNetBuild operator -(DotNetBuild command, IEnumerable args) => command.RemoveArgs(args); /// /// Appends an environment variable. @@ -722,7 +722,7 @@ public partial record DotNetRun: ICommandLine /// The command to which an environment variable will be added. /// Environment variable to add. /// Returns a new command with the corresponding changes. - public static DotNetRun operator +(DotNetRun command, (string name, string value) var) => command.AddVars(var); + public static DotNetBuild operator +(DotNetBuild command, (string name, string value) var) => command.AddVars(var); /// /// Removes environment variable by its name and value. @@ -730,7 +730,7 @@ public partial record DotNetRun: ICommandLine /// The command to which an environment variable will be removed. /// Environment variable to remove. /// Returns a new command with the corresponding changes. - public static DotNetRun operator -(DotNetRun command, (string name, string value) var) => command.RemoveVars(var); + public static DotNetBuild operator -(DotNetBuild command, (string name, string value) var) => command.RemoveVars(var); /// /// Appends environment variables. @@ -738,7 +738,7 @@ public partial record DotNetRun: ICommandLine /// The command to which environment variables will be added. /// Environment variables to add. /// Returns a new command with the corresponding changes. - public static DotNetRun operator +(DotNetRun command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + public static DotNetBuild operator +(DotNetBuild command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); /// /// Removes environment variables by their name and value. @@ -746,11 +746,11 @@ public partial record DotNetRun: ICommandLine /// The command to which environment variables will be removed. /// environment variables to remove. /// Returns a new command with the corresponding changes. - public static DotNetRun operator -(DotNetRun command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); + public static DotNetBuild operator -(DotNetBuild command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); } [ExcludeFromCodeCoverage] -public partial record DotNetTest: ICommandLine +public partial record DotNetBuildServerShutdown: ICommandLine { /// /// Appends an argument. @@ -758,7 +758,7 @@ public partial record DotNetTest: ICommandLine /// The command to which an argument will be added. /// Argument to add. /// Returns a new command with the corresponding changes. - public static DotNetTest operator +(DotNetTest command, string arg) => command.AddArgs(arg); + public static DotNetBuildServerShutdown operator +(DotNetBuildServerShutdown command, string arg) => command.AddArgs(arg); /// /// Removes an argument by its name. @@ -766,7 +766,7 @@ public partial record DotNetTest: ICommandLine /// The command to which an argument will be removed. /// Argument to remove. /// Returns a new command with the corresponding changes. - public static DotNetTest operator -(DotNetTest command, string arg) => command.RemoveArgs(arg); + public static DotNetBuildServerShutdown operator -(DotNetBuildServerShutdown command, string arg) => command.RemoveArgs(arg); /// /// Appends arguments. @@ -774,7 +774,7 @@ public partial record DotNetTest: ICommandLine /// The command to which arguments will be added. /// Arguments to add. /// Returns a new command with the corresponding changes. - public static DotNetTest operator +(DotNetTest command, IEnumerable args) => command.AddArgs(args); + public static DotNetBuildServerShutdown operator +(DotNetBuildServerShutdown command, IEnumerable args) => command.AddArgs(args); /// /// Removes arguments by their name. @@ -782,7 +782,7 @@ public partial record DotNetTest: ICommandLine /// The command to which arguments will be removed. /// Arguments to remove. /// Returns a new command with the corresponding changes. - public static DotNetTest operator -(DotNetTest command, IEnumerable args) => command.RemoveArgs(args); + public static DotNetBuildServerShutdown operator -(DotNetBuildServerShutdown command, IEnumerable args) => command.RemoveArgs(args); /// /// Appends an environment variable. @@ -790,7 +790,7 @@ public partial record DotNetTest: ICommandLine /// The command to which an environment variable will be added. /// Environment variable to add. /// Returns a new command with the corresponding changes. - public static DotNetTest operator +(DotNetTest command, (string name, string value) var) => command.AddVars(var); + public static DotNetBuildServerShutdown operator +(DotNetBuildServerShutdown command, (string name, string value) var) => command.AddVars(var); /// /// Removes environment variable by its name and value. @@ -798,7 +798,7 @@ public partial record DotNetTest: ICommandLine /// The command to which an environment variable will be removed. /// Environment variable to remove. /// Returns a new command with the corresponding changes. - public static DotNetTest operator -(DotNetTest command, (string name, string value) var) => command.RemoveVars(var); + public static DotNetBuildServerShutdown operator -(DotNetBuildServerShutdown command, (string name, string value) var) => command.RemoveVars(var); /// /// Appends environment variables. @@ -806,7 +806,7 @@ public partial record DotNetTest: ICommandLine /// The command to which environment variables will be added. /// Environment variables to add. /// Returns a new command with the corresponding changes. - public static DotNetTest operator +(DotNetTest command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + public static DotNetBuildServerShutdown operator +(DotNetBuildServerShutdown command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); /// /// Removes environment variables by their name and value. @@ -814,11 +814,11 @@ public partial record DotNetTest: ICommandLine /// The command to which environment variables will be removed. /// environment variables to remove. /// Returns a new command with the corresponding changes. - public static DotNetTest operator -(DotNetTest command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); + public static DotNetBuildServerShutdown operator -(DotNetBuildServerShutdown command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); } [ExcludeFromCodeCoverage] -public partial record DotNetToolRestore: ICommandLine +public partial record DotNetClean: ICommandLine { /// /// Appends an argument. @@ -826,7 +826,7 @@ public partial record DotNetToolRestore: ICommandLine /// The command to which an argument will be added. /// Argument to add. /// Returns a new command with the corresponding changes. - public static DotNetToolRestore operator +(DotNetToolRestore command, string arg) => command.AddArgs(arg); + public static DotNetClean operator +(DotNetClean command, string arg) => command.AddArgs(arg); /// /// Removes an argument by its name. @@ -834,7 +834,7 @@ public partial record DotNetToolRestore: ICommandLine /// The command to which an argument will be removed. /// Argument to remove. /// Returns a new command with the corresponding changes. - public static DotNetToolRestore operator -(DotNetToolRestore command, string arg) => command.RemoveArgs(arg); + public static DotNetClean operator -(DotNetClean command, string arg) => command.RemoveArgs(arg); /// /// Appends arguments. @@ -842,7 +842,7 @@ public partial record DotNetToolRestore: ICommandLine /// The command to which arguments will be added. /// Arguments to add. /// Returns a new command with the corresponding changes. - public static DotNetToolRestore operator +(DotNetToolRestore command, IEnumerable args) => command.AddArgs(args); + public static DotNetClean operator +(DotNetClean command, IEnumerable args) => command.AddArgs(args); /// /// Removes arguments by their name. @@ -850,7 +850,7 @@ public partial record DotNetToolRestore: ICommandLine /// The command to which arguments will be removed. /// Arguments to remove. /// Returns a new command with the corresponding changes. - public static DotNetToolRestore operator -(DotNetToolRestore command, IEnumerable args) => command.RemoveArgs(args); + public static DotNetClean operator -(DotNetClean command, IEnumerable args) => command.RemoveArgs(args); /// /// Appends an environment variable. @@ -858,7 +858,7 @@ public partial record DotNetToolRestore: ICommandLine /// The command to which an environment variable will be added. /// Environment variable to add. /// Returns a new command with the corresponding changes. - public static DotNetToolRestore operator +(DotNetToolRestore command, (string name, string value) var) => command.AddVars(var); + public static DotNetClean operator +(DotNetClean command, (string name, string value) var) => command.AddVars(var); /// /// Removes environment variable by its name and value. @@ -866,7 +866,7 @@ public partial record DotNetToolRestore: ICommandLine /// The command to which an environment variable will be removed. /// Environment variable to remove. /// Returns a new command with the corresponding changes. - public static DotNetToolRestore operator -(DotNetToolRestore command, (string name, string value) var) => command.RemoveVars(var); + public static DotNetClean operator -(DotNetClean command, (string name, string value) var) => command.RemoveVars(var); /// /// Appends environment variables. @@ -874,7 +874,7 @@ public partial record DotNetToolRestore: ICommandLine /// The command to which environment variables will be added. /// Environment variables to add. /// Returns a new command with the corresponding changes. - public static DotNetToolRestore operator +(DotNetToolRestore command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + public static DotNetClean operator +(DotNetClean command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); /// /// Removes environment variables by their name and value. @@ -882,7 +882,75 @@ public partial record DotNetToolRestore: ICommandLine /// The command to which environment variables will be removed. /// environment variables to remove. /// Returns a new command with the corresponding changes. - public static DotNetToolRestore operator -(DotNetToolRestore command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); + public static DotNetClean operator -(DotNetClean command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetDevCertsHttps: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetDevCertsHttps operator +(DotNetDevCertsHttps command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetDevCertsHttps operator -(DotNetDevCertsHttps command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetDevCertsHttps operator +(DotNetDevCertsHttps command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetDevCertsHttps operator -(DotNetDevCertsHttps command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetDevCertsHttps operator +(DotNetDevCertsHttps command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetDevCertsHttps operator -(DotNetDevCertsHttps command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetDevCertsHttps operator +(DotNetDevCertsHttps command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetDevCertsHttps operator -(DotNetDevCertsHttps command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); } [ExcludeFromCodeCoverage] @@ -953,6 +1021,3338 @@ public partial record MSBuild: ICommandLine public static MSBuild operator -(MSBuild command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); } +[ExcludeFromCodeCoverage] +public partial record DotNetNew: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNew operator +(DotNetNew command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNew operator -(DotNetNew command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNew operator +(DotNetNew command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNew operator -(DotNetNew command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNew operator +(DotNetNew command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNew operator -(DotNetNew command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNew operator +(DotNetNew command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNew operator -(DotNetNew command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNewList: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewList operator +(DotNetNewList command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewList operator -(DotNetNewList command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewList operator +(DotNetNewList command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewList operator -(DotNetNewList command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewList operator +(DotNetNewList command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewList operator -(DotNetNewList command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewList operator +(DotNetNewList command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewList operator -(DotNetNewList command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNewSearch: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewSearch operator +(DotNetNewSearch command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewSearch operator -(DotNetNewSearch command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewSearch operator +(DotNetNewSearch command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewSearch operator -(DotNetNewSearch command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewSearch operator +(DotNetNewSearch command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewSearch operator -(DotNetNewSearch command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewSearch operator +(DotNetNewSearch command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewSearch operator -(DotNetNewSearch command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNewDetails: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewDetails operator +(DotNetNewDetails command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewDetails operator -(DotNetNewDetails command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewDetails operator +(DotNetNewDetails command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewDetails operator -(DotNetNewDetails command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewDetails operator +(DotNetNewDetails command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewDetails operator -(DotNetNewDetails command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewDetails operator +(DotNetNewDetails command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewDetails operator -(DotNetNewDetails command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNewInstall: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewInstall operator +(DotNetNewInstall command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewInstall operator -(DotNetNewInstall command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewInstall operator +(DotNetNewInstall command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewInstall operator -(DotNetNewInstall command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewInstall operator +(DotNetNewInstall command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewInstall operator -(DotNetNewInstall command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewInstall operator +(DotNetNewInstall command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewInstall operator -(DotNetNewInstall command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNewUninstall: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewUninstall operator +(DotNetNewUninstall command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewUninstall operator -(DotNetNewUninstall command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewUninstall operator +(DotNetNewUninstall command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewUninstall operator -(DotNetNewUninstall command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewUninstall operator +(DotNetNewUninstall command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewUninstall operator -(DotNetNewUninstall command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewUninstall operator +(DotNetNewUninstall command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewUninstall operator -(DotNetNewUninstall command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNewUpdate: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewUpdate operator +(DotNetNewUpdate command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewUpdate operator -(DotNetNewUpdate command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewUpdate operator +(DotNetNewUpdate command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewUpdate operator -(DotNetNewUpdate command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewUpdate operator +(DotNetNewUpdate command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewUpdate operator -(DotNetNewUpdate command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNewUpdate operator +(DotNetNewUpdate command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNewUpdate operator -(DotNetNewUpdate command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuGetDelete: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetDelete operator +(DotNetNuGetDelete command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetDelete operator -(DotNetNuGetDelete command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetDelete operator +(DotNetNuGetDelete command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetDelete operator -(DotNetNuGetDelete command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetDelete operator +(DotNetNuGetDelete command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetDelete operator -(DotNetNuGetDelete command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetDelete operator +(DotNetNuGetDelete command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetDelete operator -(DotNetNuGetDelete command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuGetLocalsClear: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetLocalsClear operator +(DotNetNuGetLocalsClear command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetLocalsClear operator -(DotNetNuGetLocalsClear command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetLocalsClear operator +(DotNetNuGetLocalsClear command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetLocalsClear operator -(DotNetNuGetLocalsClear command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetLocalsClear operator +(DotNetNuGetLocalsClear command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetLocalsClear operator -(DotNetNuGetLocalsClear command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetLocalsClear operator +(DotNetNuGetLocalsClear command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetLocalsClear operator -(DotNetNuGetLocalsClear command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuGetLocalsList: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetLocalsList operator +(DotNetNuGetLocalsList command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetLocalsList operator -(DotNetNuGetLocalsList command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetLocalsList operator +(DotNetNuGetLocalsList command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetLocalsList operator -(DotNetNuGetLocalsList command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetLocalsList operator +(DotNetNuGetLocalsList command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetLocalsList operator -(DotNetNuGetLocalsList command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetLocalsList operator +(DotNetNuGetLocalsList command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetLocalsList operator -(DotNetNuGetLocalsList command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuGetPush: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetPush operator +(DotNetNuGetPush command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetPush operator -(DotNetNuGetPush command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetPush operator +(DotNetNuGetPush command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetPush operator -(DotNetNuGetPush command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetPush operator +(DotNetNuGetPush command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetPush operator -(DotNetNuGetPush command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetPush operator +(DotNetNuGetPush command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetPush operator -(DotNetNuGetPush command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuGetAddSource: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetAddSource operator +(DotNetNuGetAddSource command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetAddSource operator -(DotNetNuGetAddSource command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetAddSource operator +(DotNetNuGetAddSource command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetAddSource operator -(DotNetNuGetAddSource command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetAddSource operator +(DotNetNuGetAddSource command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetAddSource operator -(DotNetNuGetAddSource command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetAddSource operator +(DotNetNuGetAddSource command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetAddSource operator -(DotNetNuGetAddSource command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuGetDisableSource: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetDisableSource operator +(DotNetNuGetDisableSource command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetDisableSource operator -(DotNetNuGetDisableSource command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetDisableSource operator +(DotNetNuGetDisableSource command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetDisableSource operator -(DotNetNuGetDisableSource command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetDisableSource operator +(DotNetNuGetDisableSource command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetDisableSource operator -(DotNetNuGetDisableSource command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetDisableSource operator +(DotNetNuGetDisableSource command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetDisableSource operator -(DotNetNuGetDisableSource command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuGetEnableSource: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetEnableSource operator +(DotNetNuGetEnableSource command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetEnableSource operator -(DotNetNuGetEnableSource command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetEnableSource operator +(DotNetNuGetEnableSource command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetEnableSource operator -(DotNetNuGetEnableSource command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetEnableSource operator +(DotNetNuGetEnableSource command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetEnableSource operator -(DotNetNuGetEnableSource command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetEnableSource operator +(DotNetNuGetEnableSource command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetEnableSource operator -(DotNetNuGetEnableSource command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuGetListSource: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetListSource operator +(DotNetNuGetListSource command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetListSource operator -(DotNetNuGetListSource command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetListSource operator +(DotNetNuGetListSource command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetListSource operator -(DotNetNuGetListSource command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetListSource operator +(DotNetNuGetListSource command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetListSource operator -(DotNetNuGetListSource command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetListSource operator +(DotNetNuGetListSource command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetListSource operator -(DotNetNuGetListSource command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuGetRemoveSource: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetRemoveSource operator +(DotNetNuGetRemoveSource command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetRemoveSource operator -(DotNetNuGetRemoveSource command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetRemoveSource operator +(DotNetNuGetRemoveSource command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetRemoveSource operator -(DotNetNuGetRemoveSource command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetRemoveSource operator +(DotNetNuGetRemoveSource command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetRemoveSource operator -(DotNetNuGetRemoveSource command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetRemoveSource operator +(DotNetNuGetRemoveSource command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetRemoveSource operator -(DotNetNuGetRemoveSource command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuGetUpdateSource: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetUpdateSource operator +(DotNetNuGetUpdateSource command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetUpdateSource operator -(DotNetNuGetUpdateSource command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetUpdateSource operator +(DotNetNuGetUpdateSource command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetUpdateSource operator -(DotNetNuGetUpdateSource command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetUpdateSource operator +(DotNetNuGetUpdateSource command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetUpdateSource operator -(DotNetNuGetUpdateSource command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetUpdateSource operator +(DotNetNuGetUpdateSource command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetUpdateSource operator -(DotNetNuGetUpdateSource command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuGetVerify: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetVerify operator +(DotNetNuGetVerify command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetVerify operator -(DotNetNuGetVerify command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetVerify operator +(DotNetNuGetVerify command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetVerify operator -(DotNetNuGetVerify command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetVerify operator +(DotNetNuGetVerify command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetVerify operator -(DotNetNuGetVerify command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetVerify operator +(DotNetNuGetVerify command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetVerify operator -(DotNetNuGetVerify command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuGetTrustList: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustList operator +(DotNetNuGetTrustList command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustList operator -(DotNetNuGetTrustList command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustList operator +(DotNetNuGetTrustList command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustList operator -(DotNetNuGetTrustList command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustList operator +(DotNetNuGetTrustList command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustList operator -(DotNetNuGetTrustList command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustList operator +(DotNetNuGetTrustList command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustList operator -(DotNetNuGetTrustList command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuGetTrustSync: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustSync operator +(DotNetNuGetTrustSync command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustSync operator -(DotNetNuGetTrustSync command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustSync operator +(DotNetNuGetTrustSync command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustSync operator -(DotNetNuGetTrustSync command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustSync operator +(DotNetNuGetTrustSync command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustSync operator -(DotNetNuGetTrustSync command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustSync operator +(DotNetNuGetTrustSync command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustSync operator -(DotNetNuGetTrustSync command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuGetTrustRemove: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustRemove operator +(DotNetNuGetTrustRemove command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustRemove operator -(DotNetNuGetTrustRemove command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustRemove operator +(DotNetNuGetTrustRemove command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustRemove operator -(DotNetNuGetTrustRemove command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustRemove operator +(DotNetNuGetTrustRemove command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustRemove operator -(DotNetNuGetTrustRemove command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustRemove operator +(DotNetNuGetTrustRemove command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustRemove operator -(DotNetNuGetTrustRemove command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuGetTrustAuthor: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustAuthor operator +(DotNetNuGetTrustAuthor command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustAuthor operator -(DotNetNuGetTrustAuthor command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustAuthor operator +(DotNetNuGetTrustAuthor command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustAuthor operator -(DotNetNuGetTrustAuthor command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustAuthor operator +(DotNetNuGetTrustAuthor command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustAuthor operator -(DotNetNuGetTrustAuthor command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustAuthor operator +(DotNetNuGetTrustAuthor command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustAuthor operator -(DotNetNuGetTrustAuthor command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuGetTrustRepository: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustRepository operator +(DotNetNuGetTrustRepository command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustRepository operator -(DotNetNuGetTrustRepository command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustRepository operator +(DotNetNuGetTrustRepository command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustRepository operator -(DotNetNuGetTrustRepository command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustRepository operator +(DotNetNuGetTrustRepository command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustRepository operator -(DotNetNuGetTrustRepository command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustRepository operator +(DotNetNuGetTrustRepository command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustRepository operator -(DotNetNuGetTrustRepository command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuGetTrustCertificate: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustCertificate operator +(DotNetNuGetTrustCertificate command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustCertificate operator -(DotNetNuGetTrustCertificate command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustCertificate operator +(DotNetNuGetTrustCertificate command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustCertificate operator -(DotNetNuGetTrustCertificate command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustCertificate operator +(DotNetNuGetTrustCertificate command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustCertificate operator -(DotNetNuGetTrustCertificate command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustCertificate operator +(DotNetNuGetTrustCertificate command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustCertificate operator -(DotNetNuGetTrustCertificate command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuGetTrustSource: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustSource operator +(DotNetNuGetTrustSource command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustSource operator -(DotNetNuGetTrustSource command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustSource operator +(DotNetNuGetTrustSource command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustSource operator -(DotNetNuGetTrustSource command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustSource operator +(DotNetNuGetTrustSource command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustSource operator -(DotNetNuGetTrustSource command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustSource operator +(DotNetNuGetTrustSource command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetTrustSource operator -(DotNetNuGetTrustSource command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuGetSign: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetSign operator +(DotNetNuGetSign command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetSign operator -(DotNetNuGetSign command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetSign operator +(DotNetNuGetSign command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetSign operator -(DotNetNuGetSign command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetSign operator +(DotNetNuGetSign command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetSign operator -(DotNetNuGetSign command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetSign operator +(DotNetNuGetSign command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetSign operator -(DotNetNuGetSign command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuGetWhy: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetWhy operator +(DotNetNuGetWhy command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetWhy operator -(DotNetNuGetWhy command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetWhy operator +(DotNetNuGetWhy command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetWhy operator -(DotNetNuGetWhy command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetWhy operator +(DotNetNuGetWhy command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetWhy operator -(DotNetNuGetWhy command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetWhy operator +(DotNetNuGetWhy command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuGetWhy operator -(DotNetNuGetWhy command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuConfigGet: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigGet operator +(DotNetNuConfigGet command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigGet operator -(DotNetNuConfigGet command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigGet operator +(DotNetNuConfigGet command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigGet operator -(DotNetNuConfigGet command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigGet operator +(DotNetNuConfigGet command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigGet operator -(DotNetNuConfigGet command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigGet operator +(DotNetNuConfigGet command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigGet operator -(DotNetNuConfigGet command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuConfigSet: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigSet operator +(DotNetNuConfigSet command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigSet operator -(DotNetNuConfigSet command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigSet operator +(DotNetNuConfigSet command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigSet operator -(DotNetNuConfigSet command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigSet operator +(DotNetNuConfigSet command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigSet operator -(DotNetNuConfigSet command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigSet operator +(DotNetNuConfigSet command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigSet operator -(DotNetNuConfigSet command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuConfigUnset: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigUnset operator +(DotNetNuConfigUnset command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigUnset operator -(DotNetNuConfigUnset command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigUnset operator +(DotNetNuConfigUnset command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigUnset operator -(DotNetNuConfigUnset command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigUnset operator +(DotNetNuConfigUnset command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigUnset operator -(DotNetNuConfigUnset command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigUnset operator +(DotNetNuConfigUnset command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigUnset operator -(DotNetNuConfigUnset command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetNuConfigPaths: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigPaths operator +(DotNetNuConfigPaths command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigPaths operator -(DotNetNuConfigPaths command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigPaths operator +(DotNetNuConfigPaths command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigPaths operator -(DotNetNuConfigPaths command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigPaths operator +(DotNetNuConfigPaths command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigPaths operator -(DotNetNuConfigPaths command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigPaths operator +(DotNetNuConfigPaths command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetNuConfigPaths operator -(DotNetNuConfigPaths command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetPackageSearch: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetPackageSearch operator +(DotNetPackageSearch command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetPackageSearch operator -(DotNetPackageSearch command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetPackageSearch operator +(DotNetPackageSearch command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetPackageSearch operator -(DotNetPackageSearch command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetPackageSearch operator +(DotNetPackageSearch command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetPackageSearch operator -(DotNetPackageSearch command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetPackageSearch operator +(DotNetPackageSearch command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetPackageSearch operator -(DotNetPackageSearch command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetPack: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetPack operator +(DotNetPack command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetPack operator -(DotNetPack command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetPack operator +(DotNetPack command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetPack operator -(DotNetPack command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetPack operator +(DotNetPack command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetPack operator -(DotNetPack command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetPack operator +(DotNetPack command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetPack operator -(DotNetPack command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetPublish: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetPublish operator +(DotNetPublish command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetPublish operator -(DotNetPublish command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetPublish operator +(DotNetPublish command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetPublish operator -(DotNetPublish command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetPublish operator +(DotNetPublish command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetPublish operator -(DotNetPublish command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetPublish operator +(DotNetPublish command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetPublish operator -(DotNetPublish command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetRestore: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetRestore operator +(DotNetRestore command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetRestore operator -(DotNetRestore command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetRestore operator +(DotNetRestore command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetRestore operator -(DotNetRestore command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetRestore operator +(DotNetRestore command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetRestore operator -(DotNetRestore command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetRestore operator +(DotNetRestore command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetRestore operator -(DotNetRestore command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetRun: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetRun operator +(DotNetRun command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetRun operator -(DotNetRun command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetRun operator +(DotNetRun command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetRun operator -(DotNetRun command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetRun operator +(DotNetRun command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetRun operator -(DotNetRun command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetRun operator +(DotNetRun command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetRun operator -(DotNetRun command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetSdkCheck: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetSdkCheck operator +(DotNetSdkCheck command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetSdkCheck operator -(DotNetSdkCheck command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetSdkCheck operator +(DotNetSdkCheck command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetSdkCheck operator -(DotNetSdkCheck command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetSdkCheck operator +(DotNetSdkCheck command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetSdkCheck operator -(DotNetSdkCheck command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetSdkCheck operator +(DotNetSdkCheck command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetSdkCheck operator -(DotNetSdkCheck command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetSlnList: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetSlnList operator +(DotNetSlnList command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetSlnList operator -(DotNetSlnList command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetSlnList operator +(DotNetSlnList command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetSlnList operator -(DotNetSlnList command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetSlnList operator +(DotNetSlnList command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetSlnList operator -(DotNetSlnList command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetSlnList operator +(DotNetSlnList command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetSlnList operator -(DotNetSlnList command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetSlnAdd: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetSlnAdd operator +(DotNetSlnAdd command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetSlnAdd operator -(DotNetSlnAdd command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetSlnAdd operator +(DotNetSlnAdd command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetSlnAdd operator -(DotNetSlnAdd command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetSlnAdd operator +(DotNetSlnAdd command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetSlnAdd operator -(DotNetSlnAdd command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetSlnAdd operator +(DotNetSlnAdd command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetSlnAdd operator -(DotNetSlnAdd command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetSlnRemove: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetSlnRemove operator +(DotNetSlnRemove command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetSlnRemove operator -(DotNetSlnRemove command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetSlnRemove operator +(DotNetSlnRemove command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetSlnRemove operator -(DotNetSlnRemove command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetSlnRemove operator +(DotNetSlnRemove command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetSlnRemove operator -(DotNetSlnRemove command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetSlnRemove operator +(DotNetSlnRemove command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetSlnRemove operator -(DotNetSlnRemove command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetStore: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetStore operator +(DotNetStore command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetStore operator -(DotNetStore command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetStore operator +(DotNetStore command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetStore operator -(DotNetStore command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetStore operator +(DotNetStore command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetStore operator -(DotNetStore command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetStore operator +(DotNetStore command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetStore operator -(DotNetStore command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetTest: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetTest operator +(DotNetTest command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetTest operator -(DotNetTest command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetTest operator +(DotNetTest command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetTest operator -(DotNetTest command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetTest operator +(DotNetTest command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetTest operator -(DotNetTest command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetTest operator +(DotNetTest command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetTest operator -(DotNetTest command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetToolInstall: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolInstall operator +(DotNetToolInstall command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolInstall operator -(DotNetToolInstall command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolInstall operator +(DotNetToolInstall command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolInstall operator -(DotNetToolInstall command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolInstall operator +(DotNetToolInstall command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolInstall operator -(DotNetToolInstall command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolInstall operator +(DotNetToolInstall command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolInstall operator -(DotNetToolInstall command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetToolList: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolList operator +(DotNetToolList command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolList operator -(DotNetToolList command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolList operator +(DotNetToolList command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolList operator -(DotNetToolList command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolList operator +(DotNetToolList command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolList operator -(DotNetToolList command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolList operator +(DotNetToolList command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolList operator -(DotNetToolList command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetToolRestore: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolRestore operator +(DotNetToolRestore command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolRestore operator -(DotNetToolRestore command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolRestore operator +(DotNetToolRestore command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolRestore operator -(DotNetToolRestore command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolRestore operator +(DotNetToolRestore command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolRestore operator -(DotNetToolRestore command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolRestore operator +(DotNetToolRestore command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolRestore operator -(DotNetToolRestore command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetToolRun: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolRun operator +(DotNetToolRun command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolRun operator -(DotNetToolRun command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolRun operator +(DotNetToolRun command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolRun operator -(DotNetToolRun command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolRun operator +(DotNetToolRun command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolRun operator -(DotNetToolRun command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolRun operator +(DotNetToolRun command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolRun operator -(DotNetToolRun command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetToolSearch: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolSearch operator +(DotNetToolSearch command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolSearch operator -(DotNetToolSearch command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolSearch operator +(DotNetToolSearch command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolSearch operator -(DotNetToolSearch command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolSearch operator +(DotNetToolSearch command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolSearch operator -(DotNetToolSearch command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolSearch operator +(DotNetToolSearch command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolSearch operator -(DotNetToolSearch command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetToolUninstall: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolUninstall operator +(DotNetToolUninstall command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolUninstall operator -(DotNetToolUninstall command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolUninstall operator +(DotNetToolUninstall command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolUninstall operator -(DotNetToolUninstall command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolUninstall operator +(DotNetToolUninstall command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolUninstall operator -(DotNetToolUninstall command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolUninstall operator +(DotNetToolUninstall command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolUninstall operator -(DotNetToolUninstall command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + +[ExcludeFromCodeCoverage] +public partial record DotNetToolUpdate: ICommandLine +{ + /// + /// Appends an argument. + /// + /// The command to which an argument will be added. + /// Argument to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolUpdate operator +(DotNetToolUpdate command, string arg) => command.AddArgs(arg); + + /// + /// Removes an argument by its name. + /// + /// The command to which an argument will be removed. + /// Argument to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolUpdate operator -(DotNetToolUpdate command, string arg) => command.RemoveArgs(arg); + + /// + /// Appends arguments. + /// + /// The command to which arguments will be added. + /// Arguments to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolUpdate operator +(DotNetToolUpdate command, IEnumerable args) => command.AddArgs(args); + + /// + /// Removes arguments by their name. + /// + /// The command to which arguments will be removed. + /// Arguments to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolUpdate operator -(DotNetToolUpdate command, IEnumerable args) => command.RemoveArgs(args); + + /// + /// Appends an environment variable. + /// + /// The command to which an environment variable will be added. + /// Environment variable to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolUpdate operator +(DotNetToolUpdate command, (string name, string value) var) => command.AddVars(var); + + /// + /// Removes environment variable by its name and value. + /// + /// The command to which an environment variable will be removed. + /// Environment variable to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolUpdate operator -(DotNetToolUpdate command, (string name, string value) var) => command.RemoveVars(var); + + /// + /// Appends environment variables. + /// + /// The command to which environment variables will be added. + /// Environment variables to add. + /// Returns a new command with the corresponding changes. + public static DotNetToolUpdate operator +(DotNetToolUpdate command, IEnumerable<(string name, string value)> vars) => command.AddVars(vars); + + /// + /// Removes environment variables by their name and value. + /// + /// The command to which environment variables will be removed. + /// environment variables to remove. + /// Returns a new command with the corresponding changes. + public static DotNetToolUpdate operator -(DotNetToolUpdate command, IEnumerable<(string name, string value)> vars) => command.RemoveVars(vars); +} + [ExcludeFromCodeCoverage] public partial record VSTest: ICommandLine { diff --git a/CSharpInteractive.HostApi/CommandLines.tt b/CSharpInteractive.HostApi/CommandLines.tt index 7e25ef9..9d2ec47 100644 --- a/CSharpInteractive.HostApi/CommandLines.tt +++ b/CSharpInteractive.HostApi/CommandLines.tt @@ -1,25 +1,75 @@ // ReSharper disable InconsistentNaming namespace HostApi; - + <# var commandLineTypes = new[] { "CommandLine", // Dotnet + "DotNetCustom", + "DotNet", + "DotNetExec", + "DotNetAddPackage", + "DotNetListPackage", + "DotNetRemovePackage", + "DotNetAddReference", + "DotNetListReference", + "DotNetRemoveReference", "DotNetBuild", "DotNetBuildServerShutdown", "DotNetClean", - "DotNetCustom", + "DotNetDevCertsHttps", + "MSBuild", "DotNetNew", + "DotNetNewList", + "DotNetNewSearch", + "DotNetNewDetails", + "DotNetNewInstall", + "DotNetNewUninstall", + "DotNetNewUpdate", + "DotNetNuGetDelete", + "DotNetNuGetLocalsClear", + "DotNetNuGetLocalsList", "DotNetNuGetPush", + "DotNetNuGetAddSource", + "DotNetNuGetDisableSource", + "DotNetNuGetEnableSource", + "DotNetNuGetListSource", + "DotNetNuGetRemoveSource", + "DotNetNuGetUpdateSource", + "DotNetNuGetVerify", + "DotNetNuGetTrustList", + "DotNetNuGetTrustSync", + "DotNetNuGetTrustRemove", + "DotNetNuGetTrustAuthor", + "DotNetNuGetTrustRepository", + "DotNetNuGetTrustCertificate", + "DotNetNuGetTrustSource", + "DotNetNuGetSign", + "DotNetNuGetWhy", + "DotNetNuConfigGet", + "DotNetNuConfigSet", + "DotNetNuConfigUnset", + "DotNetNuConfigPaths", + "DotNetPackageSearch", "DotNetPack", "DotNetPublish", "DotNetRestore", "DotNetRun", + "DotNetSdkCheck", + "DotNetSlnList", + "DotNetSlnAdd", + "DotNetSlnRemove", + "DotNetStore", "DotNetTest", + "DotNetToolInstall", + "DotNetToolList", "DotNetToolRestore", - "MSBuild", + "DotNetToolRun", + "DotNetToolSearch", + "DotNetToolUninstall", + "DotNetToolUpdate", "VSTest", // Docker diff --git a/CSharpInteractive.HostApi/DotNetBlameDumpType.cs b/CSharpInteractive.HostApi/DotNetBlameDumpType.cs new file mode 100644 index 0000000..d766b00 --- /dev/null +++ b/CSharpInteractive.HostApi/DotNetBlameDumpType.cs @@ -0,0 +1,22 @@ +namespace HostApi; + +/// +/// The type of dump. +/// +public enum DotNetBlameDumpType +{ + /// + /// None + /// + None, + + /// + /// Full + /// + Full, + + /// + /// Mini + /// + Mini +} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/DotNetBuild.cs b/CSharpInteractive.HostApi/DotNetBuild.cs deleted file mode 100644 index 32d8be7..0000000 --- a/CSharpInteractive.HostApi/DotNetBuild.cs +++ /dev/null @@ -1,115 +0,0 @@ -// ReSharper disable UnusedType.Global -// ReSharper disable UnusedMember.Global -// ReSharper disable InconsistentNaming - -namespace HostApi; - -using Internal.DotNet; - -/// -/// The dotnet build command builds the project and its dependencies into a set of binaries. The binaries include the project's code in Intermediate Language (IL) files with a .dll extension. Depending on the project type and settings, other files may be included. -/// -/// -/// var configuration = Props.Get("configuration", "Release"); -/// -/// -/// new DotNetBuild().WithConfiguration(configuration) -/// .Build().EnsureSuccess(); -/// -/// -/// -/// MSBuild options for setting properties. -/// Specifies the set of command line arguments to use when starting the tool. -/// Specifies the set of environment variables that apply to this process and its child processes. -/// The URI of the NuGet package source to use during the restore operation. -/// Overrides the tool executable path. -/// Specifies the working directory for the tool to be started. -/// The project or solution file to build. If a project or solution file isn't specified, MSBuild searches the current working directory for a file that has a file extension that ends in either proj or sln and uses that file. -/// Directory in which to place the built binaries. If not specified, the default path is ./bin/<configuration>/<framework>/. For projects with multiple target frameworks (via the TargetFrameworks property), you also need to define --framework when you specify this option. -/// Compiles for a specific framework. The framework must be defined in the project file. -/// Defines the build configuration. The default for most projects is Debug, but you can override the build configuration settings in your project. -/// Specifies the target runtime. For a list of Runtime Identifiers (RIDs), see the RID catalog. If you use this option with .NET 6 SDK, use --self-contained or --no-self-contained also. -/// Sets the value of the $(VersionSuffix) property to use when building the project. This only works if the $(Version) property isn't set. Then, $(Version) is set to the $(VersionPrefix) combined with the $(VersionSuffix), separated by a dash. -/// Marks the build as unsafe for incremental build. This flag turns off incremental compilation and forces a clean rebuild of the project's dependency graph. -/// Ignores project-to-project (P2P) references and only builds the specified root project. -/// Doesn't display the startup banner or the copyright message. Available since .NET Core 3.0 SDK. -/// Doesn't execute an implicit restore during build. -/// Forces all dependencies to be resolved even if the last restore was successful. Specifying this flag is the same as deleting the project.assets.json file. -/// Publishes the .NET runtime with the application so the runtime doesn't need to be installed on the target machine. The default is true if a runtime identifier is specified. Available since .NET 6 SDK. -/// Publishes the application as a framework dependent application. A compatible .NET runtime must be installed on the target machine to run the application. Available since .NET 6 SDK. -/// Specifies the target architecture. This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --arch x86 sets the RID to win-x86. If you use this option, don&apos;t use the -r|--runtime option. Available since .NET 6 Preview 7. -/// Specifies the target operating system (OS). This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --os linux sets the RID to linux-x64. If you use this option, don't use the -r|--runtime option. Available since .NET 6. -/// Sets the verbosity level of the command. Allowed values are Quiet, Minimal, Normal, Detailed, and Diagnostic. The default is Minimal. For more information, see LoggerVerbosity. -/// Specifies a short name for this operation. -[Target] -public partial record DotNetBuild( - IEnumerable<(string name, string value)> Props, - IEnumerable Args, - IEnumerable<(string name, string value)> Vars, - IEnumerable Sources, - string ExecutablePath = "", - string WorkingDirectory = "", - string Project = "", - string Output = "", - string Framework = "", - string Configuration = "", - string Runtime = "", - string VersionSuffix = "", - bool? NoIncremental = default, - bool? NoDependencies = default, - bool? NoLogo = default, - bool? NoRestore = default, - bool? Force = default, - bool? SelfContained = default, - bool? NoSelfContained = default, - string Arch = "", - string OS = "", - DotNetVerbosity? Verbosity = default, - string ShortName = "") -{ - /// - /// Create a new instance of the command. - /// - /// Specifies the set of command line arguments to use when starting the tool. - public DotNetBuild(params string[] args) - : this([], args, [], []) - { } - - /// - public IStartInfo GetStartInfo(IHost host) - { - if (host == null) throw new ArgumentNullException(nameof(host)); - return host.CreateCommandLine(ExecutablePath) - .WithShortName(ToString()) - .WithArgs("build") - .AddNotEmptyArgs(Project) - .WithWorkingDirectory(WorkingDirectory) - .WithVars(Vars.ToArray()) - .AddMSBuildLoggers(host, Verbosity) - .AddArgs(Sources.Select(i => ("--source", (string?)i)).ToArray()) - .AddArgs( - ("--output", Output), - ("--framework", Framework), - ("--configuration", Configuration), - ("--runtime", Runtime), - ("--version-suffix", VersionSuffix), - ("--verbosity", Verbosity?.ToString().ToLowerInvariant()), - ("--arch", Arch), - ("--os", OS) - ) - .AddBooleanArgs( - ("--no-incremental", NoIncremental), - ("--no-dependencies", NoDependencies), - ("--nologo", NoLogo), - ("--no-restore", NoRestore), - ("--self-contained", SelfContained), - ("--no-self-contained", NoSelfContained), - ("--force", Force) - ) - .AddProps("-p", Props.ToArray()) - .AddArgs(Args.ToArray()); - } - - /// - public override string ToString() => "dotnet build".GetShortName(ShortName, Project); -} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/DotNetBuildServer.cs b/CSharpInteractive.HostApi/DotNetBuildServer.cs index ad376d1..7e9baac 100644 --- a/CSharpInteractive.HostApi/DotNetBuildServer.cs +++ b/CSharpInteractive.HostApi/DotNetBuildServer.cs @@ -23,4 +23,17 @@ public enum DotNetBuildServer /// Razor build server /// Razor +} + +internal static class DotNetBuildServerExtensions +{ + [SuppressMessage("ReSharper", "UnusedParameter.Global")] + public static string[] ToArgs(this IEnumerable servers, string name, string collectionSeparator) => + servers.Select(server => server switch + { + DotNetBuildServer.MSBuild => "--msbuild", + DotNetBuildServer.VbCsCompiler => "--vbcscompiler", + DotNetBuildServer.Razor => "--razor", + _ => throw new ArgumentOutOfRangeException() + }).ToArray(); } \ No newline at end of file diff --git a/CSharpInteractive.HostApi/DotNetBuildServerShutdown.cs b/CSharpInteractive.HostApi/DotNetBuildServerShutdown.cs deleted file mode 100644 index 7f9d571..0000000 --- a/CSharpInteractive.HostApi/DotNetBuildServerShutdown.cs +++ /dev/null @@ -1,66 +0,0 @@ -// ReSharper disable UnusedMember.Global -// ReSharper disable MemberCanBePrivate.Global -// ReSharper disable UnusedType.Global -// ReSharper disable StringLiteralTypo - -namespace HostApi; - -using Internal.DotNet; - -/// -/// The dotnet build server command is used to shut down build servers that are started from dotnet. -/// -/// -/// new DotNetBuildServerShutdown() -/// .Run().EnsureSuccess(); -/// -/// -/// -/// Specifies the set of command line arguments to use when starting the tool. -/// Specifies the set of environment variables that apply to this process and its child processes. -/// Build servers to shut down. By default, all servers are shut down. -/// Overrides the tool executable path. -/// Specifies the working directory for the tool to be started. -/// Specifies a short name for this operation. -[Target] -public partial record DotNetBuildServerShutdown( - IEnumerable Args, - IEnumerable<(string name, string value)> Vars, - IEnumerable Servers, - string ExecutablePath = "", - string WorkingDirectory = "", - string ShortName = "") -{ - /// - /// Create a new instance of the command. - /// - /// Specifies the set of command line arguments to use when starting the tool. - public DotNetBuildServerShutdown(params string[] args) - : this(args, [], []) - { } - - /// - public IStartInfo GetStartInfo(IHost host) - { - if (host == null) throw new ArgumentNullException(nameof(host)); - return host.CreateCommandLine(ExecutablePath) - .WithShortName(ToString()) - .WithWorkingDirectory(WorkingDirectory) - .WithVars(Vars.ToArray()) - .WithArgs("build-server", "shutdown") - .AddArgs(GetServerArg().ToArray()) - .AddArgs(Args.ToArray()); - } - - /// - public override string ToString() => "dotnet build-server shutdown".GetShortName(ShortName); - - private IEnumerable GetServerArg() => - Servers.Select(server => server switch - { - DotNetBuildServer.MSBuild => "--msbuild", - DotNetBuildServer.VbCsCompiler => "--vbcscompiler", - DotNetBuildServer.Razor => "--razor", - _ => throw new ArgumentOutOfRangeException() - }); -} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/DotNetClean.cs b/CSharpInteractive.HostApi/DotNetClean.cs deleted file mode 100644 index d18157b..0000000 --- a/CSharpInteractive.HostApi/DotNetClean.cs +++ /dev/null @@ -1,82 +0,0 @@ -// ReSharper disable UnusedType.Global -// ReSharper disable UnusedMember.Global - -namespace HostApi; - -using Internal.DotNet; - -/// -/// The dotnet clean command cleans the output of the previous build. It's implemented as an MSBuild target, so the project is evaluated when the command is run. Only the outputs created during the build are cleaned. Both intermediate (obj) and final output (bin) folders are cleaned. -/// -/// -/// new DotNetClean() -/// .WithVerbosity(DotNetVerbosity.Quiet) -/// .Build().EnsureSuccess(); -/// -/// -/// -/// MSBuild options for setting properties. -/// Specifies the set of command line arguments to use when starting the tool. -/// Specifies the set of environment variables that apply to this process and its child processes. -/// Overrides the tool executable path. -/// Specifies the working directory for the tool to be started. -/// The MSBuild project or solution to clean. If a project or solution file is not specified, MSBuild searches the current working directory for a file that has a file extension that ends in proj or sln, and uses that file. -/// The framework that was specified at build time. The framework must be defined in the project file. If you specified the framework at build time, you must specify the framework when cleaning. -/// Cleans the output folder of the specified runtime. This is used when a self-contained deployment was created. -/// Defines the build configuration. The default for most projects is Debug, but you can override the build configuration settings in your project. This option is only required when cleaning if you specified it during build time. -/// The directory that contains the build artifacts to clean. Specify the -f|--framework <FRAMEWORK> switch with the output directory switch if you specified the framework when the project was built. -/// Doesn't display the startup banner or the copyright message. Available since .NET Core 3.0 SDK. -/// Sets the verbosity level of the command. Allowed values are Quiet, Minimal, Normal, Detailed, and Diagnostic. The default is Minimal. For more information, see LoggerVerbosity. -/// Specifies a short name for this operation. -[Target] -public partial record DotNetClean( - IEnumerable<(string name, string value)> Props, - IEnumerable Args, - IEnumerable<(string name, string value)> Vars, - string ExecutablePath = "", - string WorkingDirectory = "", - string Project = "", - string Framework = "", - string Runtime = "", - string Configuration = "", - string Output = "", - bool? NoLogo = default, - DotNetVerbosity? Verbosity = default, - string ShortName = "") -{ - /// - /// Create a new instance of the command. - /// - /// Specifies the set of command line arguments to use when starting the tool. - public DotNetClean(params string[] args) - : this([], args, []) - { } - - /// - public IStartInfo GetStartInfo(IHost host) - { - if (host == null) throw new ArgumentNullException(nameof(host)); - return host.CreateCommandLine(ExecutablePath) - .WithShortName(ToString()) - .WithArgs("clean") - .AddNotEmptyArgs(Project) - .WithWorkingDirectory(WorkingDirectory) - .WithVars(Vars.ToArray()) - .AddMSBuildLoggers(host, Verbosity) - .AddArgs( - ("--output", Output), - ("--framework", Framework), - ("--runtime", Runtime), - ("--configuration", Configuration), - ("--verbosity", Verbosity?.ToString().ToLowerInvariant()) - ) - .AddBooleanArgs( - ("--nologo", NoLogo) - ) - .AddProps("-p", Props.ToArray()) - .AddArgs(Args.ToArray()); - } - - /// - public override string ToString() => "dotnet clean".GetShortName(ShortName, Project); -} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/DotNetCommands.cs b/CSharpInteractive.HostApi/DotNetCommands.cs new file mode 100644 index 0000000..f1c77a8 --- /dev/null +++ b/CSharpInteractive.HostApi/DotNetCommands.cs @@ -0,0 +1,4943 @@ +// ReSharper disable UnusedMember.Global +// ReSharper disable InconsistentNaming +namespace HostApi; +using Internal.DotNet; +using Internal; + +/// +/// Runs a dotnet application. +///

+/// You specify the path to an application .dll file to run the application. To run the application means to find and execute the entry point, which in the case of console apps is the Main method. For example, dotnet myapp.dll runs the myapp application. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Paths containing probing policy and assemblies to probe. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Specifies the path to an application .dll file to run the application. To run the application means to find and execute the entry point, which in the case of console apps is the Main method. For example, dotnet myapp. dll runs the myapp application. +/// Path to an additional .deps.json file. A deps.json file contains a list of dependencies, compilation dependencies, and version information used to address assembly conflicts. +/// Version of the .NET runtime to use to run the application. +/// Controls how roll forward is applied to the app. The SETTING can be one of the following values. If not specified, is the default. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNet( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable AdditionalProbingPaths, + string PathToApplication = "", + string AdditionalDeps = "", + string FxVersion = "", + DotNetRollForward? RollForward = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNet(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNet() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddNotEmptyArgs(PathToApplication.ToArg()) + .AddArgs(AdditionalProbingPaths.ToArgs("--additionalprobingpath", "")) + .AddArgs(AdditionalDeps.ToArgs("--additional-deps", "")) + .AddArgs(FxVersion.ToArgs("--fx-version", "")) + .AddArgs(RollForward.ToArgs("--roll-forward", "")) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, PathToApplication.ToArg()); +} + +/// +/// Executes a dotnet application. +///

+/// You specify the path to an application .dll file to run the application. To run the application means to find and execute the entry point, which in the case of console apps is the Main method. For example, dotnet myapp.dll runs the myapp application. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Paths containing probing policy and assemblies to probe. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Specifies the path to an application .dll file to run the application. To run the application means to find and execute the entry point, which in the case of console apps is the Main method. For example, dotnet myapp. dll runs the myapp application. +/// Path to a deps.json file. A deps.json file is a configuration file that contains information about dependencies necessary to run the application. This file is generated by the .NET SDK. +/// Path to an additional .deps.json file. A deps.json file contains a list of dependencies, compilation dependencies, and version information used to address assembly conflicts. +/// Version of the .NET runtime to use to run the application. +/// Controls how roll forward is applied to the app. The SETTING can be one of the following values. If not specified, is the default. +/// Path to a runtimeconfig.json file. A runtimeconfig.json file contains run-time settings and is typically named <applicationname>.runtimeconfig.json. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetExec( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable AdditionalProbingPaths, + string PathToApplication = "", + string DepsFile = "", + string AdditionalDeps = "", + string FxVersion = "", + DotNetRollForward? RollForward = default, + string RuntimeConfig = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetExec(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetExec() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("exec") + .AddNotEmptyArgs(PathToApplication.ToArg()) + .AddArgs(AdditionalProbingPaths.ToArgs("--additionalprobingpath", "")) + .AddArgs(DepsFile.ToArgs("--depsfile", "")) + .AddArgs(AdditionalDeps.ToArgs("--additional-deps", "")) + .AddArgs(FxVersion.ToArgs("--fx-version", "")) + .AddArgs(RollForward.ToArgs("--roll-forward", "")) + .AddArgs(RuntimeConfig.ToArgs("--runtimeconfig", "")) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "exec", PathToApplication.ToArg()); +} + +/// +/// Adds or updates a package reference in a project file. +///

+/// This command provides a convenient option to add or update a package reference in a project file. When you run the command, there's a compatibility check to ensure the package is compatible with the frameworks in the project. If the check passes and the package isn't referenced in the project file, a <PackageReference> element is added to the project file. If the check passes and the package is already referenced in the project file, the <PackageReference> element is updated to the latest compatible version. After the project file is updated, dotnet restore is run. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// The URI of the NuGet package source to use during this operation. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The project or solution file to operate on. If not specified, the command searches the current directory for one. If more than one solution or project is found, an error is thrown. +/// The package reference to add. +/// Adds a package reference only when targeting a specific framework. +/// Doesn't execute an implicit restore when running the command. +/// The directory where to restore the packages. The default package restore location is %userprofile%\.nuget\packages on Windows and ~/.nuget/packages on macOS and Linux. +/// Allows prerelease packages to be installed. Available since .NET Core 5 SDK. +/// Version of the package +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetAddPackage( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable Sources, + string Project = "", + string PackageName = "", + string Framework = "", + bool? NoRestore = default, + string PackageDirectory = "", + bool? Prerelease = default, + string Version = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetAddPackage(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetAddPackage() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("add") + .AddNotEmptyArgs(Project.ToArg()) + .AddArgs("package") + .AddNotEmptyArgs(PackageName.ToArg()) + .AddArgs(Sources.ToArgs("--source", "")) + .AddArgs(Framework.ToArgs("--framework", "")) + .AddArgs(PackageDirectory.ToArgs("--package-directory", "")) + .AddArgs(Version.ToArgs("--version", "")) + .AddBooleanArgs( + ("--no-restore", NoRestore), + ("--prerelease", Prerelease), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "add", Project.ToArg(), "package", PackageName.ToArg()); +} + +/// +/// Lists the package references for a project or solution. +///

+/// This command provides a convenient option to list all NuGet package references for a specific project or a solution. You first need to build the project in order to have the assets needed for this command to process. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Displays only the packages applicable for the specified target framework. +/// The URI of the NuGet package source to use during this operation. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The project or solution file to operate on. If not specified, the command searches the current directory for one. If more than one solution or project is found, an error is thrown. +/// The NuGet sources to use when searching for newer packages. Requires the --outdated option. +/// Displays packages that have been deprecated. +/// Considers only the packages with a matching major version number when searching for newer packages. Requires the --outdated or --deprecated option. +/// Considers only the packages with a matching major and minor version numbers when searching for newer packages. Requires the --outdated or --deprecated option. +/// Considers packages with prerelease versions when searching for newer packages. Requires the --outdated or --deprecated option. +/// Lists transitive packages, in addition to the top-level packages. When specifying this option, you get a list of packages that the top-level packages depend on. +/// Lists packages that have newer versions available. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetListPackage( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable Frameworks, + IEnumerable Sources, + string Project = "", + string Config = "", + bool? Deprecated = default, + bool? HighestMinor = default, + bool? HighestPatch = default, + bool? IncludePrerelease = default, + bool? IncludeTransitive = default, + bool? Outdated = default, + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetListPackage(params string[] args) + : this(args, [], [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetListPackage() + : this([], [], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("list") + .AddNotEmptyArgs(Project.ToArg()) + .AddArgs("package") + .AddArgs(Frameworks.ToArgs("--framework", "")) + .AddArgs(Sources.ToArgs("--source", "")) + .AddArgs(Config.ToArgs("--config", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--deprecated", Deprecated), + ("--highest-minor", HighestMinor), + ("--highest-patch", HighestPatch), + ("--include-prerelease", IncludePrerelease), + ("--include-transitive", IncludeTransitive), + ("--outdated", Outdated), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "list", Project.ToArg(), "package"); +} + +/// +/// Removes package reference from a project file. +///

+/// This command provides a convenient option to remove a NuGet package reference from a project. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The project or solution file to operate on. If not specified, the command searches the current directory for one. If more than one solution or project is found, an error is thrown. +/// The package reference to add. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetRemovePackage( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string Project = "", + string PackageName = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetRemovePackage(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetRemovePackage() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("remove") + .AddNotEmptyArgs(Project.ToArg()) + .AddArgs("package") + .AddNotEmptyArgs(PackageName.ToArg()) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "remove", Project.ToArg(), "package", PackageName.ToArg()); +} + +/// +/// Adds project-to-project (P2P) references. +///

+/// This command provides a convenient option to add project references to a project. After running the command, the <ProjectReference> elements are added to the project file. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Project-to-project (P2P) references to add. Specify one or more projects. Glob patterns are supported on Unix/Linux-based systems. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The project or solution file to operate on. If not specified, the command searches the current directory for one. If more than one solution or project is found, an error is thrown. +/// Adds project references only when targeting a specific framework using the TFM format. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetAddReference( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable References, + string Project = "", + string Framework = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetAddReference(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetAddReference() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("add") + .AddNotEmptyArgs(Project.ToArg()) + .AddArgs("reference") + .AddNotEmptyArgs(References.ToArray().ToArg()) + .AddArgs(References.ToArgs("--source", "")) + .AddArgs(Framework.ToArgs("--framework", "")) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, new [] {"add", Project.ToArg(), "reference"}.Concat(References).ToArray()); +} + +/// +/// Lists project-to-project references. +///

+/// This command provides a convenient option to list project references for a given project. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The project or solution file to operate on. If not specified, the command searches the current directory for one. If more than one solution or project is found, an error is thrown. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetListReference( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string Project = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetListReference(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetListReference() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("list") + .AddNotEmptyArgs(Project.ToArg()) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "list", Project.ToArg()); +} + +/// +/// Removes project-to-project (P2P) references. +///

+/// This command provides a convenient option to remove project references from a project. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Project-to-project (P2P) references to remove. You can specify one or multiple projects. Glob patterns are supported on Unix/Linux based terminals. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The project or solution file to operate on. If not specified, the command searches the current directory for one. If more than one solution or project is found, an error is thrown. +/// Removes the reference only when targeting a specific framework using the TFM format. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetRemoveReference( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable References, + string Project = "", + string Framework = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetRemoveReference(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetRemoveReference() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("remove") + .AddNotEmptyArgs(Project.ToArg()) + .AddArgs("reference") + .AddNotEmptyArgs(References.ToArray().ToArg()) + .AddArgs(References.ToArgs("--source", "")) + .AddArgs(Framework.ToArgs("--framework", "")) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, new [] {"remove", Project.ToArg(), "reference"}.Concat(References).ToArray()); +} + +/// +/// Builds a project and all of its dependencies. +///

+/// This command builds the project and its dependencies into a set of binaries. The binaries include the project's code in Intermediate Language (IL) files with a .dll extension. For executable projects targeting versions earlier than .NET Core 3.0, library dependencies from NuGet are typically NOT copied to the output folder. They're resolved from the NuGet global packages folder at run time. With that in mind, the product of dotnet build isn't ready to be transferred to another machine to run. To create a version of the application that can be deployed, you need to publish it (for example, with the dotnet publish command). For more information, see .NET Application Deployment. +///

+///

+/// For executable projects targeting .NET Core 3.0 and later, library dependencies are copied to the output folder. This means that if there isn't any other publish-specific logic (such as Web projects have), the build output should be deployable. +///

+/// +/// +/// var configuration = Props.Get("configuration", "Release"); +/// +/// +/// new DotNetBuild().WithConfiguration(configuration) +/// .Build().EnsureSuccess(); +/// +/// +///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// MSBuild options for setting properties. +/// The URI of the NuGet package source to use during this operation. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The project or solution file to operate on. If not specified, the command searches the current directory for one. If more than one solution or project is found, an error is thrown. +/// Specifies the target architecture. This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --arch x86 sets the RID to win-x86. If you use this option, don't use the -r|--runtime option. Available since .NET 6 Preview 7. +/// All build output files from the executed command will go in subfolders under the specified path, separated by project. +/// Defines the build configuration. The default for most projects is Debug, but you can override the build configuration settings in your project. +/// Forces the command to ignore any persistent build servers. This option provides a consistent way to disable all use of build caching, which forces a build from scratch. A build that doesn't rely on caches is useful when the caches might be corrupted or incorrect for some reason. Available since .NET 7 SDK. +/// Builds and runs the app using the specified framework. The framework must be specified in the project file. +/// Forces all dependencies to be resolved even if the last restore was successful. Specifying this flag is the same as deleting the project.assets.json file. +/// When restoring a project with project-to-project (P2P) references, restores the root project and not the references. +/// Marks the build as unsafe for incremental build. This flag turns off incremental compilation and forces a clean rebuild of the project's dependency graph. +/// Doesn't execute an implicit restore when running the command. +/// Doesn't display the startup banner or the copyright message. +/// Publishes the application as a framework dependent application. A compatible .NET runtime must be installed on the target machine to run the application. Available since .NET 6 SDK. +/// Directory in which to place the built binaries. If not specified, the default path is ./bin/<configuration>/<framework>/. For projects with multiple target frameworks (via the TargetFrameworks property), you also need to define --framework when you specify this option. +/// Specifies the target operating system (OS). This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --os linux sets the RID to linux-x64. If you use this option, don't use the -r|--runtime option. Available since .NET 6. +/// Specifies the target runtime to restore packages for. For a list of Runtime Identifiers (RIDs), see the RID catalog. -r short option available since .NET Core 3.0 SDK. +/// Publishes the .NET runtime with the application so the runtime doesn't need to be installed on the target machine. The default is true if a runtime identifier is specified. Available since .NET 6. +/// Specifies whether the terminal logger should be used for the build output. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Sets the RuntimeIdentifier to a platform portable RuntimeIdentifier based on the one of your machine. This happens implicitly with properties that require a RuntimeIdentifier, such as SelfContained, PublishAot, PublishSelfContained, PublishSingleFile, and PublishReadyToRun. If the property is set to false, that implicit resolution will no longer occur. +/// Sets the value of the $(VersionSuffix) property to use when building the project. This only works if the $(Version) property isn't set. Then, $(Version) is set to the $(VersionPrefix) combined with the $(VersionSuffix), separated by a dash. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetBuild( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable<(string name, string value)> Props, + IEnumerable Sources, + string Project = "", + string Arch = "", + string ArtifactsPath = "", + string Configuration = "", + bool? DisableBuildServers = default, + string Framework = "", + bool? Force = default, + bool? NoDependencies = default, + bool? NoIncremental = default, + bool? NoRestore = default, + bool? NoLogo = default, + bool? NoSelfContained = default, + string Output = "", + string OS = "", + string Runtime = "", + bool? SelfContained = default, + DotNetTerminalLogger? TerminalLogger = default, + DotNetVerbosity? Verbosity = default, + bool? UseCurrentRuntime = default, + string VersionSuffix = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetBuild(params string[] args) + : this(args, [], [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetBuild() + : this([], [], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("build") + .AddNotEmptyArgs(Project.ToArg()) + .AddMSBuildLoggers(host, Verbosity) + .AddArgs(Sources.ToArgs("--source", "")) + .AddArgs(Arch.ToArgs("--arch", "")) + .AddArgs(ArtifactsPath.ToArgs("--artifacts-path", "")) + .AddArgs(Configuration.ToArgs("--configuration", "")) + .AddArgs(Framework.ToArgs("--framework", "")) + .AddArgs(Output.ToArgs("--output", "")) + .AddArgs(OS.ToArgs("--os", "")) + .AddArgs(Runtime.ToArgs("--runtime", "")) + .AddArgs(TerminalLogger.ToArgs("--tl", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddArgs(VersionSuffix.ToArgs("--version-suffix", "")) + .AddBooleanArgs( + ("--disable-build-servers", DisableBuildServers), + ("--force", Force), + ("--no-dependencies", NoDependencies), + ("--no-incremental", NoIncremental), + ("--no-restore", NoRestore), + ("--nologo", NoLogo), + ("--no-self-contained", NoSelfContained), + ("--self-contained", SelfContained), + ("--use-current-runtime", UseCurrentRuntime), + ("--diagnostics", Diagnostics) + ) + .AddProps("--property", Props.ToArray()) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "build", Project.ToArg()); +} + +/// +/// Shuts down build servers that are started from dotnet. +///

+/// By default, all servers are shut down. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Shuts down build servers that are started from dotnet. By default, all servers are shut down. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetBuildServerShutdown( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable Servers, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetBuildServerShutdown(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetBuildServerShutdown() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("build-server") + .AddArgs("shutdown") + .AddArgs(Servers.ToArgs("", "")) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "build-server", "shutdown"); +} + +/// +/// Cleans the output of a project. +///

+/// This command cleans the output of the previous build. It's implemented as an MSBuild target, so the project is evaluated when the command is run. Only the outputs created during the build are cleaned. Both intermediate (obj) and final output (bin) folders are cleaned. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// MSBuild options for setting properties. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The project or solution file to operate on. If not specified, the command searches the current directory for one. If more than one solution or project is found, an error is thrown. +/// All build output files from the executed command will go in subfolders under the specified path, separated by project. +/// Defines the build configuration. The default for most projects is Debug, but you can override the build configuration settings in your project. +/// Builds and runs the app using the specified framework. The framework must be specified in the project file. +/// Doesn't display the startup banner or the copyright message. +/// Directory in which to place the built binaries. If not specified, the default path is ./bin/<configuration>/<framework>/. For projects with multiple target frameworks (via the TargetFrameworks property), you also need to define --framework when you specify this option. +/// Specifies the target runtime to restore packages for. For a list of Runtime Identifiers (RIDs), see the RID catalog. -r short option available since .NET Core 3.0 SDK. +/// Specifies whether the terminal logger should be used for the build output. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetClean( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable<(string name, string value)> Props, + string Project = "", + string ArtifactsPath = "", + string Configuration = "", + string Framework = "", + bool? NoLogo = default, + string Output = "", + string Runtime = "", + DotNetTerminalLogger? TerminalLogger = default, + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetClean(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetClean() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("clean") + .AddNotEmptyArgs(Project.ToArg()) + .AddMSBuildLoggers(host, Verbosity) + .AddArgs(ArtifactsPath.ToArgs("--artifacts-path", "")) + .AddArgs(Configuration.ToArgs("--configuration", "")) + .AddArgs(Framework.ToArgs("--framework", "")) + .AddArgs(Output.ToArgs("--output", "")) + .AddArgs(Runtime.ToArgs("--runtime", "")) + .AddArgs(TerminalLogger.ToArgs("--tl", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--nologo", NoLogo), + ("--diagnostics", Diagnostics) + ) + .AddProps("--property", Props.ToArray()) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "clean", Project.ToArg()); +} + +/// +/// Generates a self-signed certificate to enable HTTPS use in development. +///

+/// This command manages a self-signed certificate to enable HTTPS use in local web app development. Its main functions are: +///
- Generating a certificate for use with HTTPS endpoints during development. +///
- Trusting the generated certificate on the local machine. +///
- Removing the generated certificate from the local machine. +///
- Exporting a certificate in various formats so that it can be used by other tools. +///
- Importing an existing certificate generated by the tool into the local machine. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Checks for the existence of the development certificate but doesn't perform any action. Use this option with the --trust option to check if the certificate is not only valid but also trusted. +/// Removes all HTTPS development certificates from the certificate store by using the .NET certificate store API. Doesn't remove any physical files that were created by using the --export-path option. On macOS in .NET 7.0, the dotnet dev-certs command creates the certificate on a path on disk, and the clean operation removes that certificate file. +/// Exports the certificate to a file so that it can be used by other tools. Specify the full path to the exported certificate file, including the file name. +/// When used with --export-path, specifies the format of the exported certificate file. Valid values are PFX and PEM, case-insensitive. PFX is the default. The file format is independent of the file name extension. For example, if you specify --format pfx and --export-path ./cert.pem, you'll get a file named cert.pem in PFX format. +/// Imports the provided HTTPS development certificate into the local machine. Requires that you also specify the --clean option, which clears out any existing HTTPS developer certificates. +/// Doesn't use a password for the key when exporting a certificate to PEM format files. The key file is exported in plain text. This option is not applicable to PFX files and is intended for internal testing use only. +/// Specifies the password to use. +/// Display warnings and errors only. +/// rusts the certificate on the local machine. If this option isn't specified, the certificate is added to the certificate store but not to a trusted list. When combined with the --check option, validates that the certificate is trusted. +/// Display debug information. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetDevCertsHttps( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + bool? Check = default, + bool? Clean = default, + string ExportPath = "", + string Format = "", + string Import = "", + bool? NoPassword = default, + bool? Password = default, + bool? Quiet = default, + bool? Trust = default, + bool? Verbose = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetDevCertsHttps(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetDevCertsHttps() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("dev-certs") + .AddArgs("https") + .AddArgs(ExportPath.ToArgs("--export-path", "")) + .AddArgs(Format.ToArgs("--format", "")) + .AddArgs(Import.ToArgs("--import", "")) + .AddBooleanArgs( + ("--check", Check), + ("--clean", Clean), + ("--no-password", NoPassword), + ("--password", Password), + ("--quiet", Quiet), + ("--trust", Trust), + ("--verbose", Verbose), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "dev-certs", "https"); +} + +/// +/// Creates a new project, configuration file, or solution based on the specified template. +///

+/// This command creates a .NET project or other artifacts based on a template. The command calls the template engine to create the artifacts on disk based on the specified template and options. +///

+/// +/// +/// new DotNetNew() +/// .WithTemplateName("console") +/// .WithName("MyApp") +/// .WithForce(true) +/// .Run().EnsureSuccess(); +/// +/// +///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The template to instantiate when the command is invoked. Each template might have specific options you can pass. +/// Displays a summary of what would happen if the given command were run if it would result in a template creation. Available since .NET Core 2.2 SDK. +/// Forces content to be generated even if it would change existing files. This is required when the template chosen would override existing files in the output directory. +/// The language of the template to create. The language accepted varies by the template (see defaults in the arguments section). Not valid for some templates. +/// The name for the created output. If no name is specified, the name of the current directory is used. +/// Specifies the target framework. It expects a target framework moniker (TFM). Examples: "net6.0", "net7.0-macos". This value will be reflected in the project file. +/// Disables checking for template package updates when instantiating a template. Available since .NET SDK 6.0.100. +/// Location to place the generated output. The default is the current directory. +/// Doesn't execute an implicit restore when running the command. +/// The project that the template is added to. This project is used for context evaluation. If not specified, the project in the current or parent directories will be used. Available since .NET SDK 7.0.100. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNew( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string TemplateName = "", + bool? DryRun = default, + bool? Force = default, + DotNetLanguage? Language = default, + string Name = "", + string Framework = "", + bool? NoUpdateCheck = default, + string Output = "", + bool? NoRestore = default, + string Project = "", + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNew(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNew() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("new") + .AddNotEmptyArgs(TemplateName.ToArg()) + .AddArgs(Language.ToArgs("--language", "")) + .AddArgs(Name.ToArgs("--name", "")) + .AddArgs(Framework.ToArgs("--framework", "")) + .AddArgs(Output.ToArgs("--output", "")) + .AddArgs(Project.ToArgs("--project", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--dry-run", DryRun), + ("--force", Force), + ("-no-update-check", NoUpdateCheck), + ("--no-restore", NoRestore), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "new", TemplateName.ToArg()); +} + +/// +/// Lists available templates to be run using dotnet new. +///

+/// This command lists available templates to use with dotnet new. If the <TEMPLATE_NAME> is specified, lists templates containing the specified name. This option lists only default and installed templates. To find templates in NuGet that you can install locally, use the search command. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Columns to display in the output. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// If the argument is specified, only the templates containing TEMPLATE_NAME in template name or short name will be shown. +/// Filters templates based on template author. Partial match is supported. Available since .NET SDK 5.0.300. +/// Displays all columns in the output. Available since .NET SDK 5.0.300. +/// Disables checking if the template meets the constraints to be run. Available since .NET SDK 7.0.100. +/// Filters templates based on language supported by the template. The language accepted varies by the template. Not valid for some templates. +/// Location to place the generated output. The default is the current directory. For the list command, it might be necessary to specify the output directory to correctly evaluate constraints for the template. Available since .NET SDK 7.0.100. +/// The project that the template is added to. For the list command, it might be needed to specify the project the template is being added to to correctly evaluate constraints for the template. Available since .NET SDK 7.0.100. +/// Filters templates based on template tags. To be selected, a template must have at least one tag that exactly matches the criteria. Available since .NET SDK 5.0.300. +/// Filters templates based on template type. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNewList( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable Columns, + string TemplateName = "", + string Author = "", + bool? ColumnsAll = default, + bool? IgnoreConstraints = default, + DotNetLanguage? Language = default, + string Output = "", + string Project = "", + string Tag = "", + DotNetTemplateType? Type = default, + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNewList(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNewList() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("new") + .AddArgs("list") + .AddNotEmptyArgs(TemplateName.ToArg()) + .AddArgs(Columns.ToArgs("--columns", "")) + .AddArgs(Author.ToArgs("--author", "")) + .AddArgs(Language.ToArgs("--language", "")) + .AddArgs(Output.ToArgs("--output", "")) + .AddArgs(Project.ToArgs("--project", "")) + .AddArgs(Tag.ToArgs("--tag", "")) + .AddArgs(Type.ToArgs("--type", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--columns-all", ColumnsAll), + ("--ignore-constraints", IgnoreConstraints), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "new", "list", TemplateName.ToArg()); +} + +/// +/// Searches for the templates supported by dotnet new on NuGet.org. +///

+/// This command searches for templates supported by dotnet new on NuGet.org. When the <TEMPLATE_NAME> is specified, searches for templates containing the specified name. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Columns to display in the output. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// If the argument is specified, only the templates containing TEMPLATE_NAME in template name or short name will be shown. +/// Filters templates based on template author. Partial match is supported. Available since .NET SDK 5.0.300. +/// Displays all columns in the output. Available since .NET SDK 5.0.300. +/// Filters templates based on language supported by the template. +/// Filters templates based on NuGet package ID. A partial match is supported. +/// Filters templates based on template tags. To be selected, a template must have at least one tag that exactly matches the criteria. +/// Filters templates based on template type. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNewSearch( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable Columns, + string TemplateName = "", + string Author = "", + bool? ColumnsAll = default, + DotNetLanguage? Language = default, + string Package = "", + string Tag = "", + DotNetTemplateType? Type = default, + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNewSearch(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNewSearch() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("new") + .AddArgs("search") + .AddNotEmptyArgs(TemplateName.ToArg()) + .AddArgs(Columns.ToArgs("--columns", "")) + .AddArgs(Author.ToArgs("--author", "")) + .AddArgs(Language.ToArgs("--language", "")) + .AddArgs(Package.ToArgs("--package", "")) + .AddArgs(Tag.ToArgs("--tag", "")) + .AddArgs(Type.ToArgs("--type", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--columns-all", ColumnsAll), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "new", "search", TemplateName.ToArg()); +} + +/// +/// Displays template package metadata. +///

+/// This command displays the metadata of the template package from the package name provided. By default, the command searches for the latest available version. If the package is installed locally or is found on the official NuGet website, it also displays the templates that the package contains, otherwise it only displays basic metadata. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// The URI of the NuGet package source to use during this operation. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// If the argument is specified, only the templates containing TEMPLATE_NAME in template name or short name will be shown. +/// Forces all dependencies to be resolved even if the last restore was successful. Specifying this flag is the same as deleting the project.assets.json file. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNewDetails( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable Sources, + string TemplateName = "", + bool? Force = default, + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNewDetails(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNewDetails() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("new") + .AddArgs("details") + .AddNotEmptyArgs(TemplateName.ToArg()) + .AddArgs(Sources.ToArgs("--add-source", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--force", Force), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "new", "details", TemplateName.ToArg()); +} + +/// +/// Installs a template package. +///

+/// This command installs a template package from the PATH or NUGET_ID provided. If you want to install a specific version or prerelease version of a template package, specify the version in the format <package-name>::<package-version>. By default, dotnet new passes * for the version, which represents the latest stable package version. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// The URI of the NuGet package source to use during this operation. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The folder on the file system or the NuGet package identifier to install the template package from. dotnet new attempts to install the NuGet package from the NuGet sources available for the current working directory and the sources specified via the --add-source option. If you want to install a specific version or prerelease version of a template package from NuGet source, specify the version in the format <package-name>::<package-version>. +/// Forces all dependencies to be resolved even if the last restore was successful. Specifying this flag is the same as deleting the project.assets.json file. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNewInstall( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable Sources, + string Package = "", + bool? Force = default, + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNewInstall(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNewInstall() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("new") + .AddArgs("install") + .AddNotEmptyArgs(Package.ToArg()) + .AddArgs(Sources.ToArgs("--add-source", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--force", Force), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "new", "install", Package.ToArg()); +} + +/// +/// Uninstalls a template package. +///

+/// This command uninstalls a template package at the PATH or NUGET_ID provided. When the <PATH|NUGET_ID> value isn't specified, all currently installed template packages and their associated templates are displayed. When specifying NUGET_ID, don't include the version number. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The folder on the file system or the NuGet package identifier the package was installed from. Note that the version for the NuGet package should not be specified. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNewUninstall( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string Package = "", + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNewUninstall(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNewUninstall() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("new") + .AddArgs("uninstall") + .AddNotEmptyArgs(Package.ToArg()) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "new", "uninstall", Package.ToArg()); +} + +/// +/// Updates installed template packages. +///

+/// This command updates installed template packages. The dotnet new update command with --check-only option checks for available updates for installed template packages without applying them. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// The URI of the NuGet package source to use during this operation. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Only checks for updates and displays the template packages to be updated, without applying any updates. +/// Only checks for updates and displays the template packages to be updated, without applying any updates. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNewUpdate( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable Sources, + bool? CheckOnly = default, + bool? DryRun = default, + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNewUpdate(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNewUpdate() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("new") + .AddArgs("update") + .AddArgs(Sources.ToArgs("--add-source", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--check-only", CheckOnly), + ("--dry-run", DryRun), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "new", "update"); +} + +/// +/// Deletes or unlists a package from the server. +///

+/// This command deletes or unlists a package from the server. For nuget.org, the action is to unlist the package. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Name/ID of the package to delete. +/// Version of the package to delete. +/// Forces the application to run using an invariant, English-based culture. +/// The API key for the server. +/// Doesn't append "api/v2/package" to the source URL. +/// Specifies the server URL. NuGet identifies a UNC or local folder source and simply copies the file there instead of pushing it using HTTP. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuGetDelete( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string PackageName = "", + string PackageVersion = "", + bool? ForceEnglishOutput = default, + string ApiKey = "", + bool? NoServiceEndpoint = default, + string Source = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuGetDelete(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuGetDelete() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("delete") + .AddNotEmptyArgs(PackageName.ToArg()) + .AddNotEmptyArgs(PackageVersion.ToArg()) + .AddArgs("--non-interactive") + .AddArgs(ApiKey.ToArgs("--api-key", "")) + .AddArgs(Source.ToArgs("--source", "")) + .AddBooleanArgs( + ("--force-english-output", ForceEnglishOutput), + ("--no-service-endpoint", NoServiceEndpoint), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "delete", PackageName.ToArg(), PackageVersion.ToArg()); +} + +/// +/// Clears local NuGet resources. +///

+/// This command clears local NuGet resources in the http-request cache, temporary cache, or machine-wide global packages folder. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The cache location to clear. +/// Forces the application to run using an invariant, English-based culture. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuGetLocalsClear( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + NuGetCacheLocation? CacheLocation = default, + bool? ForceEnglishOutput = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuGetLocalsClear(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuGetLocalsClear() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("locals") + .AddNotEmptyArgs(CacheLocation.ToArg()) + .AddArgs("--clear") + .AddBooleanArgs( + ("--force-english-output", ForceEnglishOutput), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "locals", CacheLocation.ToArg()); +} + +/// +/// Lists local NuGet resources. +///

+/// This command lists local NuGet resources in the http-request cache, temporary cache, or machine-wide global packages folder. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The cache location to list. +/// Forces the application to run using an invariant, English-based culture. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuGetLocalsList( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + NuGetCacheLocation? CacheLocation = default, + bool? ForceEnglishOutput = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuGetLocalsList(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuGetLocalsList() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("locals") + .AddNotEmptyArgs(CacheLocation.ToArg()) + .AddArgs("--list") + .AddBooleanArgs( + ("--force-english-output", ForceEnglishOutput), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "locals", CacheLocation.ToArg()); +} + +/// +/// Pushes a package to the server and publishes it. +///

+/// This command pushes a package to the server and publishes it. The push command uses server and credential details found in the system's NuGet config file or chain of config files. NuGet's default configuration is obtained by loading %AppData%\NuGet\NuGet.config (Windows) or $HOME/.nuget/NuGet/NuGet.Config (Linux/macOS), then loading any nuget.config or .nuget\nuget.config starting from the root of drive and ending in the current directory. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Specifies the file path to the package to be pushed. +/// Disables buffering when pushing to an HTTP(S) server to reduce memory usage. +/// Forces the application to run using an invariant, English-based culture. +/// The API key for the server. +/// Doesn't push symbols (even if present). +/// Doesn't append "api/v2/package" to the source URL. +/// Specifies the server URL. NuGet identifies a UNC or local folder source and simply copies the file there instead of pushing it using HTTP. +/// When pushing multiple packages to an HTTP(S) server, treats any 409 Conflict response as a warning so that other pushes can continue. +/// The API key for the symbol server. +/// Specifies the symbol server URL. +/// Specifies the timeout for pushing to a server in seconds. Defaults to 300 seconds (5 minutes). Specifying 0 applies the default value. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuGetPush( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string Package = "", + bool? DisableBuffering = default, + bool? ForceEnglishOutput = default, + string ApiKey = "", + bool? NoSymbols = default, + bool? NoServiceEndpoint = default, + string Source = "", + bool? SkipDuplicate = default, + string SymbolApiKey = "", + string SymbolSource = "", + int? Timeout = default, + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuGetPush(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuGetPush() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("push") + .AddNotEmptyArgs(Package.ToArg()) + .AddArgs(ApiKey.ToArgs("--api-key", "")) + .AddArgs(Source.ToArgs("--source", "")) + .AddArgs(SymbolApiKey.ToArgs("--symbol-api-key", "")) + .AddArgs(SymbolSource.ToArgs("--symbol-source", "")) + .AddArgs(Timeout.ToArgs("--timeout", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--disable-buffering", DisableBuffering), + ("--force-english-output", ForceEnglishOutput), + ("--no-symbols", NoSymbols), + ("--no-service-endpoint", NoServiceEndpoint), + ("--skip-duplicate", SkipDuplicate), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "push", Package.ToArg()); +} + +/// +/// Add a NuGet source. +///

+/// This command adds a new package source to your NuGet configuration files. When adding multiple package sources, be careful not to introduce a dependency confusion vulnerability. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// List of valid authentication types for this source. Set this to basic if the server advertises NTLM or Negotiate and your credentials must be sent using the Basic mechanism, for instance when using a PAT with on-premises Azure DevOps Server. Other valid values include negotiate, kerberos, ntlm, and digest, but these values are unlikely to be useful. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Path to the package source. +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// Allows HTTP connections for adding or updating packages. This method is not secure. Available since .NET 9 SDK. +/// Name of the source. +/// Password to be used when connecting to an authenticated source. +/// Enables storing portable package source credentials by disabling password encryption. Storing passwords in clear text is strongly discouraged. +/// Username to be used when connecting to an authenticated source. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuGetAddSource( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable ValidAuthenticationTypes, + string PackageSourcePath = "", + string ConfigFile = "", + bool? AllowInsecureConnections = default, + string Name = "", + string Password = "", + bool? StorePasswordInClearText = default, + string Username = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuGetAddSource(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuGetAddSource() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("add") + .AddArgs("source") + .AddNotEmptyArgs(PackageSourcePath.ToArg()) + .AddArgs(ValidAuthenticationTypes.ToArgs("--valid-authentication-types", "")) + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddArgs(Name.ToArgs("--name", "")) + .AddArgs(Password.ToArgs("--password", "")) + .AddArgs(Username.ToArgs("--username", "")) + .AddBooleanArgs( + ("--allow-insecure-connections", AllowInsecureConnections), + ("--store-password-in-clear-text", StorePasswordInClearText), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "add", "source", PackageSourcePath.ToArg()); +} + +/// +/// Disable a NuGet source. +///

+/// This command disables an existing source in your NuGet configuration files. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Name of the source. +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuGetDisableSource( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string Name = "", + string ConfigFile = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuGetDisableSource(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuGetDisableSource() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("disable") + .AddArgs("source") + .AddNotEmptyArgs(Name.ToArg()) + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "disable", "source", Name.ToArg()); +} + +/// +/// Enable a NuGet source. +///

+/// This command enables an existing source in your NuGet configuration files. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Name of the source. +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuGetEnableSource( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string Name = "", + string ConfigFile = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuGetEnableSource(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuGetEnableSource() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("enable") + .AddArgs("source") + .AddNotEmptyArgs(Name.ToArg()) + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "enable", "source", Name.ToArg()); +} + +/// +/// Lists all configured NuGet sources. +///

+/// This command lists all existing sources from your NuGet configuration files. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// The format of the list command output: Detailed (the default) and Short. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuGetListSource( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string ConfigFile = "", + NuGetListFormat? Format = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuGetListSource(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuGetListSource() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("list") + .AddArgs("source") + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddArgs(Format.ToArgs("--format", "")) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "list", "source"); +} + +/// +/// Remove a NuGet source. +///

+/// This command removes an existing source from your NuGet configuration files. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Name of the source. +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuGetRemoveSource( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string Name = "", + string ConfigFile = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuGetRemoveSource(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuGetRemoveSource() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("remove") + .AddArgs("source") + .AddNotEmptyArgs(Name.ToArg()) + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "remove", "source", Name.ToArg()); +} + +/// +/// Update a NuGet source. +///

+/// This command updates an existing source in your NuGet configuration files. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// List of valid authentication types for this source. Set this to basic if the server advertises NTLM or Negotiate and your credentials must be sent using the Basic mechanism, for instance when using a PAT with on-premises Azure DevOps Server. Other valid values include negotiate, kerberos, ntlm, and digest, but these values are unlikely to be useful. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Name of the source. +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// Password to be used when connecting to an authenticated source. +/// Path to the package source. +/// Enables storing portable package source credentials by disabling password encryption. Storing passwords in clear text is strongly discouraged. +/// Username to be used when connecting to an authenticated source. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuGetUpdateSource( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable ValidAuthenticationTypes, + string Name = "", + string ConfigFile = "", + string Password = "", + string Source = "", + bool? StorePasswordInClearText = default, + string Username = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuGetUpdateSource(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuGetUpdateSource() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("update") + .AddArgs("source") + .AddNotEmptyArgs(Name.ToArg()) + .AddArgs(ValidAuthenticationTypes.ToArgs("--valid-authentication-types", "")) + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddArgs(Password.ToArgs("--password", "")) + .AddArgs(Source.ToArgs("--source", "")) + .AddArgs(Username.ToArgs("--username", "")) + .AddBooleanArgs( + ("--store-password-in-clear-text", StorePasswordInClearText), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "update", "source", Name.ToArg()); +} + +/// +/// Verifies a signed NuGet package. +///

+/// This command verifies a signed NuGet package. This command requires a certificate root store that is valid for both code signing and timestamping. Also, this command may not be supported on some combinations of operating system and .NET SDK. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Specifies the file path to the package(s) to be verified. +/// Verify that the signer certificate matches with one of the specified SHA256 fingerprints. This option can be supplied multiple times to provide multiple fingerprints. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Specifies that all verifications possible should be performed on the package(s). By default, only signatures are verified. +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuGetVerify( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable Packages, + IEnumerable Fingerprints, + bool? All = default, + string ConfigFile = "", + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuGetVerify(params string[] args) + : this(args, [], [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuGetVerify() + : this([], [], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("verify") + .AddNotEmptyArgs(Packages.ToArray().ToArg()) + .AddArgs(Packages.ToArgs("", "")) + .AddArgs(Fingerprints.ToArgs("--certificate-fingerprint", "")) + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--all", All), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, new [] {"nuget", "verify"}.Concat(Packages).ToArray()); +} + +/// +/// Lists all the trusted signers in the configuration. +///

+/// This option will include all the certificates (with fingerprint and fingerprint algorithm) each signer has. If a certificate has a preceding [U], it means that certificate entry has allowUntrustedRoot set as true. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuGetTrustList( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string ConfigFile = "", + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuGetTrustList(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuGetTrustList() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("trust") + .AddArgs("list") + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "trust", "list"); +} + +/// +/// Deletes the current list of certificates and replaces them with an up-to-date list from the repository. +///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The name of the existing trusted signer to sync. +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuGetTrustSync( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string Name = "", + string ConfigFile = "", + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuGetTrustSync(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuGetTrustSync() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("trust") + .AddArgs("sync") + .AddNotEmptyArgs(Name.ToArg()) + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "trust", "sync", Name.ToArg()); +} + +/// +/// Removes any trusted signers that match the given name. +///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The name of the existing trusted signer to remove. +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuGetTrustRemove( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string Name = "", + string ConfigFile = "", + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuGetTrustRemove(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuGetTrustRemove() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("trust") + .AddArgs("remove") + .AddNotEmptyArgs(Name.ToArg()) + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "trust", "remove", Name.ToArg()); +} + +/// +/// Adds a trusted signer with the given name, based on the author signature of the package. +///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The name of the trusted signer to add. If NAME already exists in the configuration, the signature is appended. +/// The given PACKAGE should be a local path to the signed .nupkg file. +/// Specifies if the certificate for the trusted signer should be allowed to chain to an untrusted root. This is not recommended. +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuGetTrustAuthor( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string Name = "", + string Package = "", + bool? AllowUntrustedRoot = default, + string ConfigFile = "", + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuGetTrustAuthor(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuGetTrustAuthor() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("trust") + .AddArgs("author") + .AddNotEmptyArgs(Name.ToArg()) + .AddNotEmptyArgs(Package.ToArg()) + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--allow-untrusted-root", AllowUntrustedRoot), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "trust", "author", Name.ToArg(), Package.ToArg()); +} + +/// +/// Adds a trusted signer with the given name, based on the repository signature or countersignature of a signed package. +///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// List of trusted owners to further restrict the trust of a repository. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The name of the trusted signer to add. If NAME already exists in the configuration, the signature is appended. +/// The given PACKAGE should be a local path to the signed .nupkg file. +/// Specifies if the certificate for the trusted signer should be allowed to chain to an untrusted root. This is not recommended. +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuGetTrustRepository( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable Owners, + string Name = "", + string Package = "", + bool? AllowUntrustedRoot = default, + string ConfigFile = "", + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuGetTrustRepository(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuGetTrustRepository() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("trust") + .AddArgs("repository") + .AddNotEmptyArgs(Name.ToArg()) + .AddNotEmptyArgs(Package.ToArg()) + .AddArgs(Owners.ToArgs("--owners", ",")) + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--allow-untrusted-root", AllowUntrustedRoot), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "trust", "repository", Name.ToArg(), Package.ToArg()); +} + +/// +/// Adds a trusted signer with the given name, based on a certificate fingerprint. +///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The name of the trusted signer to add. If a trusted signer with the given name already exists, the certificate item is added to that signer. Otherwise a trusted author is created with a certificate item from the given certificate information. +/// The fingerprint of the certificate. +/// Specifies the hash algorithm used to calculate the certificate fingerprint. Defaults to SHA256. Values supported are SHA256, SHA384 and SHA512. +/// Specifies if the certificate for the trusted signer should be allowed to chain to an untrusted root. This is not recommended. +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuGetTrustCertificate( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string Name = "", + string Fingerprint = "", + NuGetCertificateAlgorithm? Algorithm = default, + bool? AllowUntrustedRoot = default, + string ConfigFile = "", + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuGetTrustCertificate(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuGetTrustCertificate() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("trust") + .AddArgs("certificate") + .AddNotEmptyArgs(Name.ToArg()) + .AddNotEmptyArgs(Fingerprint.ToArg()) + .AddArgs(Algorithm.ToArgs("--algorithm", "")) + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--allow-untrusted-root", AllowUntrustedRoot), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "trust", "certificate", Name.ToArg(), Fingerprint.ToArg()); +} + +/// +/// Adds a trusted signer based on a given package source. +///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// List of trusted owners to further restrict the trust of a repository. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The name of the trusted signer to add. If only <NAME> is provided without --<source-url>, the package source from your NuGet configuration files with the same name is added to the trusted list. If <NAME> already exists in the configuration, the package source is appended to it. +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// If a source-url is provided, it must be a v3 package source URL (like https://api.nuget.org/v3/index.json). Other package source types are not supported. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuGetTrustSource( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable Owners, + string Name = "", + string ConfigFile = "", + string SourceUrl = "", + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuGetTrustSource(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuGetTrustSource() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("trust") + .AddArgs("source") + .AddNotEmptyArgs(Name.ToArg()) + .AddArgs(Owners.ToArgs("--owners", ",")) + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddArgs(SourceUrl.ToArgs("--source-url", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "trust", "source", Name.ToArg()); +} + +/// +/// Signs all the NuGet packages matching the first argument with a certificate. +///

+/// This command signs all the packages matching the first argument with a certificate. The certificate with the private key can be obtained from a file or from a certificate installed in a certificate store by providing a subject name or a SHA-1 fingerprint. This command requires a certificate root store that is valid for both code signing and timestamping. Also, this command may not be supported on some combinations of operating system and .NET SDK. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Specifies the file path to the packages to be signed. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Specifies the file path to the certificate to be used in signing the package. This option currently supports only PKCS12 (PFX) files that contain the certificate's private key. +/// Specifies the name of the X.509 certificate store to use to search for the certificate. Defaults to "My", the X.509 certificate store for personal certificates. This option should be used when specifying the certificate via --certificate-subject-name or --certificate-fingerprint options. +/// Specifies the name of the X.509 certificate store use to search for the certificate. Defaults to "CurrentUser", the X.509 certificate store used by the current user. This option should be used when specifying the certificate via --certificate-subject-name or --certificate-fingerprint options. +/// Specifies the subject name of the certificate used to search a local certificate store for the certificate. The search is a case-insensitive string comparison using the supplied value, which finds all certificates with the subject name containing that string, regardless of other subject values. The certificate store can be specified by --certificate-store-name and --certificate-store-location options. This option currently supports only a single matching certificate in the result. If there are multiple matching certificates in the result, or no matching certificate in the result, the sign command will fail. +/// Specifies the fingerprint of the certificate used to search a local certificate store for the certificate. Starting with .NET 9, this option can be used to specify the SHA-1, SHA-256, SHA-384, or SHA-512 fingerprint of the certificate. However, a NU3043 warning is raised when a SHA-1 certificate fingerprint is used because it is no longer considered secure. All the previous versions of the .NET SDK continue to accept only SHA-1 certificate fingerprint. +/// Specifies the certificate password, if needed. If a certificate is password protected but no password is provided, the sign command will fail. +/// Hash algorithm to be used to sign the package. Defaults to SHA256. Possible values are SHA256, SHA384, and SHA512. +/// Specifies the directory where the signed package should be saved. If this option isn't specified, by default the original package is overwritten by the signed package. +/// Indicate that the current signature should be overwritten. By default the command will fail if the package already has a signature. +/// Hash algorithm to be used by the RFC 3161 timestamp server. Defaults to SHA256. +/// URL to an RFC 3161 timestamping server. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuGetSign( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable Packages, + string CertificatePath = "", + string CertificateStoreName = "", + string CertificateStoreLocation = "", + string CertificateSubjectName = "", + string CertificateFingerprint = "", + string CertificatePassword = "", + NuGetCertificateAlgorithm? HashAlgorithm = default, + string Output = "", + bool? Overwrite = default, + NuGetCertificateAlgorithm? TimestampHashAlgorithm = default, + string TimestampingServer = "", + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuGetSign(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuGetSign() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("sign") + .AddNotEmptyArgs(Packages.ToArray().ToArg()) + .AddArgs(CertificatePath.ToArgs("--certificate-path", "")) + .AddArgs(CertificateStoreName.ToArgs("--certificate-store-name", "")) + .AddArgs(CertificateStoreLocation.ToArgs("--certificate-store-location", "")) + .AddArgs(CertificateSubjectName.ToArgs("--certificate-subject-name", "")) + .AddArgs(CertificateFingerprint.ToArgs("--certificate-fingerprint", "")) + .AddArgs(CertificatePassword.ToArgs("--certificate-password", "")) + .AddArgs(HashAlgorithm.ToArgs("--hash-algorithm", "")) + .AddArgs(Output.ToArgs("--output", "")) + .AddArgs(TimestampHashAlgorithm.ToArgs("--timestamp-hash-algorithm", "")) + .AddArgs(TimestampingServer.ToArgs("--timestamper", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--overwrite", Overwrite), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, new [] {"nuget", "sign"}.Concat(Packages).ToArray()); +} + +/// +/// Shows the dependency graph for a particular package. +///

+/// This command shows the dependency graph for a particular package for a given project or solution. Starting from the .NET 9 SDK, it's possible to pass a NuGet assets file in place of the project file, in order to use the command with projects that can't be restored with the .NET SDK. First, restore the project in Visual Studio, or msbuild.exe. By default the assets file is in the project's obj\ directory, but you can find the location with msbuild.exe path\to\project.proj -getProperty:ProjectAssetsFile. Finally, run dotnet nuget why path\to\project.assets.json SomePackage. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// The target frameworks for which dependency graphs are shown. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The project or solution file to operate on. If a directory is specified, the command searches the directory for a project or solution file. If more than one project or solution is found, an error is thrown. +/// The package name to look up in the dependency graph. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuGetWhy( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable Frameworks, + string Project = "", + string Package = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuGetWhy(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuGetWhy() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("why") + .AddNotEmptyArgs(Project.ToArg()) + .AddNotEmptyArgs(Package.ToArg()) + .AddArgs(Frameworks.ToArgs("--framework", "")) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "why", Project.ToArg(), Package.ToArg()); +} + +/// +/// Gets the NuGet configuration settings that will be applied. +///

+/// This command gets the NuGet configuration settings that will be applied from the config section. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// ALL is default value, gets all merged NuGet configuration settings from multiple NuGet configuration files that will be applied, when invoking NuGet command from the working directory path. Otherwise gets the effective value of the specified configuration settings of the config section. +/// Indicate that the NuGet configuration file path will be shown beside the configuration settings. +/// Specifies the directory to start from when listing configuration files. If not specified, the current directory is used. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuConfigGet( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string ConfigKey = "ALL", + bool? ShowPath = default, + string Directory = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuConfigGet(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuConfigGet() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("config") + .AddArgs("get") + .AddNotEmptyArgs(ConfigKey.ToArg()) + .AddArgs(Directory.ToArgs("--working-directory", "")) + .AddBooleanArgs( + ("--show-path", ShowPath), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "config", "get", ConfigKey.ToArg()); +} + +/// +/// Set the value of a specified NuGet configuration setting. +///

+/// This command sets the values for NuGet configuration settings that will be applied from the config section. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The key of the settings that are to be set. +/// The value of the settings that are to be set. +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuConfigSet( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string ConfigKey = "", + string ConfigValue = "", + string ConfigFile = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuConfigSet(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuConfigSet() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("config") + .AddArgs("set") + .AddNotEmptyArgs(ConfigKey.ToArg()) + .AddNotEmptyArgs(ConfigValue.ToArg()) + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "config", "set", ConfigKey.ToArg(), ConfigValue.ToArg()); +} + +/// +/// Removes the key-value pair from a specified NuGet configuration setting. +///

+/// This command unsets the values for NuGet configuration settings that will be applied from the config section. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The key of the settings that are to be removed. +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuConfigUnset( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string ConfigKey = "", + string ConfigFile = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuConfigUnset(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuConfigUnset() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("config") + .AddArgs("unset") + .AddNotEmptyArgs(ConfigKey.ToArg()) + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "config", "unset", ConfigKey.ToArg()); +} + +/// +/// Lists nuget configuration files currently being appplied to a directory. +///

+/// This command lists the paths to all NuGet configuration files that will be applied when invoking NuGet commands in a specific directory. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Specifies the directory to start from when listing configuration files. If not specified, the current directory is used. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetNuConfigPaths( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string Directory = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetNuConfigPaths(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetNuConfigPaths() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("nuget") + .AddArgs("config") + .AddArgs("paths") + .AddArgs(Directory.ToArgs("--working-directory", "")) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "nuget", "config", "paths"); +} + +/// +/// Packs the code into a NuGet package. +///

+/// The dotnet pack command builds the project and creates NuGet packages. The result of this command is a NuGet package (that is, a .nupkg file). +///

+///

+/// NuGet dependencies of the packed project are added to the .nuspec file, so they're properly resolved when the package is installed. If the packed project has references to other projects, the other projects aren't included in the package. Currently, you must have a package per project if you have project-to-project dependencies. +///

+///

+/// By default, dotnet pack builds the project first. If you wish to avoid this behavior, pass the --no-build option. This option is often useful in Continuous Integration (CI) build scenarios where you know the code was previously built. +///

+/// +/// +/// new DotNetPack() +/// .Build().EnsureSuccess(); +/// +/// +///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// MSBuild options for setting properties. +/// The URI of the NuGet package source to use during this operation. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The project or solution to pack. It's either a path to a csproj, vbproj, or fsproj file, or to a solution file or directory. If not specified, the command searches the current directory for a project or solution file. +/// All build output files from the executed command will go in subfolders under the specified path, separated by project. +/// Defines the build configuration. The default for most projects is Debug, but you can override the build configuration settings in your project. +/// Forces all dependencies to be resolved even if the last restore was successful. Specifying this flag is the same as deleting the project.assets.json file. +/// Includes the debug symbols NuGet packages in addition to the regular NuGet packages in the output directory. The sources files are included in the src folder within the symbols package. +/// Includes the debug symbols NuGet packages in addition to the regular NuGet packages in the output directory. +/// Doesn't build the project before packing. It also implicitly sets the --no-restore flag. +/// When restoring a project with project-to-project (P2P) references, restores the root project and not the references. +/// Marks the build as unsafe for incremental build. This flag turns off incremental compilation and forces a clean rebuild of the project's dependency graph. +/// Doesn't execute an implicit restore when running the command. +/// Doesn't display the startup banner or the copyright message. +/// Publishes the application as a framework dependent application. A compatible .NET runtime must be installed on the target machine to run the application. Available since .NET 6 SDK. +/// Directory in which to place the built binaries. If not specified, the default path is ./bin/<configuration>/<framework>/. For projects with multiple target frameworks (via the TargetFrameworks property), you also need to define --framework when you specify this option. +/// Specifies the target operating system (OS). This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --os linux sets the RID to linux-x64. If you use this option, don't use the -r|--runtime option. Available since .NET 6. +/// Specifies the target runtime to restore packages for. For a list of Runtime Identifiers (RIDs), see the RID catalog. -r short option available since .NET Core 3.0 SDK. +/// Publishes the .NET runtime with the application so the runtime doesn't need to be installed on the target machine. The default is true if a runtime identifier is specified. Available since .NET 6. +/// Specifies whether the terminal logger should be used for the build output. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Sets the RuntimeIdentifier to a platform portable RuntimeIdentifier based on the one of your machine. This happens implicitly with properties that require a RuntimeIdentifier, such as SelfContained, PublishAot, PublishSelfContained, PublishSingleFile, and PublishReadyToRun. If the property is set to false, that implicit resolution will no longer occur. +/// Sets the value of the $(VersionSuffix) property to use when building the project. This only works if the $(Version) property isn't set. Then, $(Version) is set to the $(VersionPrefix) combined with the $(VersionSuffix), separated by a dash. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetPack( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable<(string name, string value)> Props, + IEnumerable Sources, + string Project = "", + string ArtifactsPath = "", + string Configuration = "", + bool? Force = default, + string IncludeSource = "", + string IncludeSymbols = "", + bool? NoBuild = default, + bool? NoDependencies = default, + bool? NoIncremental = default, + bool? NoRestore = default, + bool? NoLogo = default, + bool? NoSelfContained = default, + string Output = "", + string OS = "", + string Runtime = "", + bool? SelfContained = default, + DotNetTerminalLogger? TerminalLogger = default, + DotNetVerbosity? Verbosity = default, + bool? UseCurrentRuntime = default, + string VersionSuffix = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetPack(params string[] args) + : this(args, [], [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetPack() + : this([], [], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("pack") + .AddNotEmptyArgs(Project.ToArg()) + .AddMSBuildLoggers(host, Verbosity) + .AddArgs(Sources.ToArgs("--source", "")) + .AddArgs(ArtifactsPath.ToArgs("--artifacts-path", "")) + .AddArgs(Configuration.ToArgs("--configuration", "")) + .AddArgs(IncludeSource.ToArgs("--include-source", "")) + .AddArgs(IncludeSymbols.ToArgs("--include-symbols", "")) + .AddArgs(Output.ToArgs("--output", "")) + .AddArgs(OS.ToArgs("--os", "")) + .AddArgs(Runtime.ToArgs("--runtime", "")) + .AddArgs(TerminalLogger.ToArgs("--tl", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddArgs(VersionSuffix.ToArgs("--version-suffix", "")) + .AddBooleanArgs( + ("--force", Force), + ("--no-build", NoBuild), + ("--no-dependencies", NoDependencies), + ("--no-incremental", NoIncremental), + ("--no-restore", NoRestore), + ("--nologo", NoLogo), + ("--no-self-contained", NoSelfContained), + ("--self-contained", SelfContained), + ("--use-current-runtime", UseCurrentRuntime), + ("--diagnostics", Diagnostics) + ) + .AddProps("--property", Props.ToArray()) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "pack", Project.ToArg()); +} + +/// +/// Searches for a NuGet package. +///

+/// This command searches for a NuGet package. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// The URI of the NuGet package source to use during this operation. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Specifies the search term to filter results. Use this argument to search for packages matching the provided query. +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// This option narrows the search to only include packages whose IDs exactly match the specified search term, effectively filtering out any partial matches. It provides a concise list of all available versions for the identified package. Causes --take and --skip options to be ignored. Utilize this option to display all available versions of a specified package. +/// The format options are table and json. The default is table. +/// Allow prerelease packages to be shown. +/// The number of results to skip, for pagination. The default value is 0. +/// The number of results to return. The default value is 20. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetPackageSearch( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable Sources, + string SearchTerms = "", + string ConfigFile = "", + bool? ExactMatch = default, + DotNetPackageSearchResultFormat? Format = default, + bool? Prerelease = default, + int? Skip = default, + int? Take = default, + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetPackageSearch(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetPackageSearch() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("package") + .AddArgs("search") + .AddArgs("paths") + .AddNotEmptyArgs(SearchTerms.ToArg()) + .AddArgs(Sources.ToArgs("--source", "")) + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddArgs(Format.ToArgs("--format", "")) + .AddArgs(Skip.ToArgs("--skip", "")) + .AddArgs(Take.ToArgs("--take", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--exact-match", ExactMatch), + ("--prerelease", Prerelease), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "package", "search", "paths", SearchTerms.ToArg()); +} + +/// +/// Publishes the application and its dependencies to a folder for deployment to a hosting system. +///

+/// This command compiles the application, reads through its dependencies specified in the project file, and publishes the resulting set of files to a directory. +///

+/// +/// +/// new DotNetPublish().AddProps(("PublishDir", ".publish")) +/// .Build().EnsureSuccess(); +/// +/// +///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// MSBuild options for setting properties. +/// The URI of the NuGet package source to use during this operation. +/// Specifies one or several target manifests to use to trim the set of packages published with the app. The manifest file is part of the output of the dotnet store command. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The project or solution file to operate on. If not specified, the command searches the current directory for one. If more than one solution or project is found, an error is thrown. +/// Specifies the target architecture. This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --arch x86 sets the RID to win-x86. If you use this option, don't use the -r|--runtime option. Available since .NET 6 Preview 7. +/// All build output files from the executed command will go in subfolders under the specified path, separated by project. +/// Defines the build configuration. The default for most projects is Debug, but you can override the build configuration settings in your project. +/// Forces the command to ignore any persistent build servers. This option provides a consistent way to disable all use of build caching, which forces a build from scratch. A build that doesn't rely on caches is useful when the caches might be corrupted or incorrect for some reason. Available since .NET 7 SDK. +/// Builds and runs the app using the specified framework. The framework must be specified in the project file. +/// Forces all dependencies to be resolved even if the last restore was successful. Specifying this flag is the same as deleting the project.assets.json file. +/// Doesn't build the project before publishing. It also implicitly sets the --no-restore flag. +/// When restoring a project with project-to-project (P2P) references, restores the root project and not the references. +/// Doesn't display the startup banner or the copyright message. +/// Doesn't execute an implicit restore when running the command. +/// Specifies the path for the output directory. If not specified, it defaults to [project_file_folder]/bin/[configuration]/[framework]/publish/ for a framework-dependent executable and cross-platform binaries. It defaults to [project_file_folder]/bin/[configuration]/[framework]/[runtime]/publish/ for a self-contained executable. In a web project, if the output folder is in the project folder, successive dotnet publish commands result in nested output folders. For example, if the project folder is myproject, and the publish output folder is myproject/publish, and you run dotnet publish twice, the second run puts content files such as .config and .json files in myproject/publish/publish. To avoid nesting publish folders, specify a publish folder that isn't directly under the project folder, or exclude the publish folder from the project. +/// Specifies the target operating system (OS). This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --os linux sets the RID to linux-x64. If you use this option, don't use the -r|--runtime option. Available since .NET 6. +/// Publishes the .NET runtime with your application so the runtime doesn't need to be installed on the target machine. Default is true if a runtime identifier is specified and the project is an executable project (not a library project). For more information, see .NET application publishing and Publish .NET apps with the .NET CLI. +/// Publishes the application as a framework dependent application. A compatible .NET runtime must be installed on the target machine to run the application. Available since .NET 6 SDK. +/// Publishes the application for a given runtime. For a list of Runtime Identifiers (RIDs), see the RID catalog. For more information, see .NET application publishing and Publish .NET apps with the .NET CLI. +/// Specifies whether the terminal logger should be used for the build output. +/// Sets the RuntimeIdentifier to a platform portable RuntimeIdentifier based on the one of your machine. This happens implicitly with properties that require a RuntimeIdentifier, such as SelfContained, PublishAot, PublishSelfContained, PublishSingleFile, and PublishReadyToRun. If the property is set to false, that implicit resolution will no longer occur. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Sets the value of the $(VersionSuffix) property to use when building the project. This only works if the $(Version) property isn't set. Then, $(Version) is set to the $(VersionPrefix) combined with the $(VersionSuffix), separated by a dash. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetPublish( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable<(string name, string value)> Props, + IEnumerable Sources, + IEnumerable Manifests, + string Project = "", + string Arch = "", + string ArtifactsPath = "", + string Configuration = "", + bool? DisableBuildServers = default, + string Framework = "", + bool? Force = default, + bool? NoBuild = default, + bool? NoDependencies = default, + bool? NoLogo = default, + bool? NoRestore = default, + string Output = "", + string OS = "", + bool? SelfContained = default, + bool? NoSelfContained = default, + string Runtime = "", + DotNetTerminalLogger? TerminalLogger = default, + bool? UseCurrentRuntime = default, + DotNetVerbosity? Verbosity = default, + string VersionSuffix = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetPublish(params string[] args) + : this(args, [], [], [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetPublish() + : this([], [], [], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("publish") + .AddNotEmptyArgs(Project.ToArg()) + .AddMSBuildLoggers(host, Verbosity) + .AddArgs(Sources.ToArgs("--source", "")) + .AddArgs(Manifests.ToArgs("--manifest", "")) + .AddArgs(Arch.ToArgs("--arch", "")) + .AddArgs(ArtifactsPath.ToArgs("--artifacts-path", "")) + .AddArgs(Configuration.ToArgs("--configuration", "")) + .AddArgs(Framework.ToArgs("--framework", "")) + .AddArgs(Output.ToArgs("--output", "")) + .AddArgs(OS.ToArgs("--os", "")) + .AddArgs(Runtime.ToArgs("--runtime", "")) + .AddArgs(TerminalLogger.ToArgs("--tl", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddArgs(VersionSuffix.ToArgs("--version-suffix", "")) + .AddBooleanArgs( + ("--disable-build-servers", DisableBuildServers), + ("--force", Force), + ("--no-build", NoBuild), + ("--no-dependencies", NoDependencies), + ("--nologo", NoLogo), + ("--no-restore", NoRestore), + ("--self-contained", SelfContained), + ("--no-self-contained", NoSelfContained), + ("--use-current-runtime", UseCurrentRuntime), + ("--diagnostics", Diagnostics) + ) + .AddProps("--property", Props.ToArray()) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "publish", Project.ToArg()); +} + +/// +/// Restores the dependencies and tools of a project. +///

+/// A .NET project typically references external libraries in NuGet packages that provide additional functionality. These external dependencies are referenced in the project file (.csproj or .vbproj). When you run the dotnet restore command, the .NET CLI uses NuGet to look for these dependencies and download them if necessary. It also ensures that all the dependencies required by the project are compatible with each other and that there are no conflicts between them. Once the command is completed, all the dependencies required by the project are available in a local cache and can be used by the .NET CLI to build and run the application. +///

+///

+/// Sometimes, it might be inconvenient to run the implicit NuGet restore with these commands. For example, some automated systems, such as build systems, need to call dotnet restore explicitly to control when the restore occurs so that they can control network usage. To prevent the implicit NuGet restore, you can use the --no-restore flag with any of these commands. +///

+/// +/// +/// new DotNetRestore() +/// .Build().EnsureSuccess(); +/// +/// +///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// MSBuild options for setting properties. +/// The URI of the NuGet package source to use during this operation. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The project or solution file to operate on. If not specified, the command searches the current directory for one. If more than one solution or project is found, an error is thrown. +/// Specifies the target architecture. This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --arch x86 sets the RID to win-x86. If you use this option, don't use the -r|--runtime option. Available since .NET 6 Preview 7. +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// Forces the command to ignore any persistent build servers. This option provides a consistent way to disable all use of build caching, which forces a build from scratch. A build that doesn't rely on caches is useful when the caches might be corrupted or incorrect for some reason. Available since .NET 7 SDK. +/// Disables restoring multiple projects in parallel. +/// Forces all dependencies to be resolved even if the last restore was successful. Specifying this flag is the same as deleting the project.assets.json file. +/// Forces restore to reevaluate all dependencies even if a lock file already exists. +/// Only warn about failed sources if there are packages meeting the version requirement. +/// Output location where project lock file is written. By default, this is PROJECT_ROOT\packages.lock.json. +/// Don't allow updating project lock file. +/// Specifies to not cache HTTP requests. +/// When restoring a project with project-to-project (P2P) references, restores the root project and not the references. +/// Specifies the directory for restored packages. +/// Specifies the target runtime to restore packages for. For a list of Runtime Identifiers (RIDs), see the RID catalog. -r short option available since .NET Core 3.0 SDK. +/// Specifies whether the terminal logger should be used for the build output. +/// Sets the RuntimeIdentifier to a platform portable RuntimeIdentifier based on the one of your machine. This happens implicitly with properties that require a RuntimeIdentifier, such as SelfContained, PublishAot, PublishSelfContained, PublishSingleFile, and PublishReadyToRun. If the property is set to false, that implicit resolution will no longer occur. +/// Enables project lock file to be generated and used with restore. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetRestore( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable<(string name, string value)> Props, + IEnumerable Sources, + string Project = "", + string Arch = "", + string ConfigFile = "", + bool? DisableBuildServers = default, + bool? DisableParallel = default, + bool? Force = default, + bool? ForceEvaluate = default, + bool? IgnoreFailedSources = default, + string LockFilePath = "", + bool? LockedMode = default, + bool? NoCache = default, + bool? NoDependencies = default, + string Packages = "", + string Runtime = "", + DotNetTerminalLogger? TerminalLogger = default, + bool? UseCurrentRuntime = default, + bool? UseLockFile = default, + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetRestore(params string[] args) + : this(args, [], [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetRestore() + : this([], [], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("restore") + .AddNotEmptyArgs(Project.ToArg()) + .AddMSBuildLoggers(host, Verbosity) + .AddArgs(Sources.ToArgs("--source", "")) + .AddArgs(Arch.ToArgs("--arch", "")) + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddArgs(LockFilePath.ToArgs("--lock-file-path", "")) + .AddArgs(Packages.ToArgs("--packages", "")) + .AddArgs(Runtime.ToArgs("--runtime", "")) + .AddArgs(TerminalLogger.ToArgs("--tl", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--disable-build-servers", DisableBuildServers), + ("--disable-parallel", DisableParallel), + ("--force", Force), + ("--force-evaluate", ForceEvaluate), + ("--ignore-failed-sources", IgnoreFailedSources), + ("--locked-mode", LockedMode), + ("--no-cache", NoCache), + ("--no-dependencies", NoDependencies), + ("--use-current-runtime", UseCurrentRuntime), + ("--use-lock-file", UseLockFile), + ("--diagnostics", Diagnostics) + ) + .AddProps("--property", Props.ToArray()) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "restore", Project.ToArg()); +} + +/// +/// Runs source code without any explicit compile or launch commands. +///

+/// This command provides a convenient option to run your application from the source code with one command. It's useful for fast iterative development from the command line. The command depends on the dotnet build command to build the code. Any requirements for the build apply to dotnet run as well. +///

+///

+/// To run the application, the dotnet run command resolves the dependencies of the application that are outside of the shared runtime from the NuGet cache. Because it uses cached dependencies, it's not recommended to use dotnet run to run applications in production. Instead, create a deployment using the dotnet publish command and deploy the published output. +///

+/// +/// +/// new DotNetNew() +/// .WithTemplateName("console") +/// .WithName("MyApp") +/// .WithForce(true) +/// .Run().EnsureSuccess(); +/// +/// +/// new DotNetRun().WithWorkingDirectory("MyApp") +/// .Build().EnsureSuccess(); +/// +/// +///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// MSBuild options for setting properties. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Specifies the target architecture. This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --arch x86 sets the RID to win-x86. If you use this option, don't use the -r|--runtime option. Available since .NET 6 Preview 7. +/// Defines the build configuration. The default for most projects is Debug, but you can override the build configuration settings in your project. +/// Builds and runs the app using the specified framework. The framework must be specified in the project file. +/// Forces all dependencies to be resolved even if the last restore was successful. Specifying this flag is the same as deleting the project.assets.json file. +/// The name of the launch profile (if any) to use when launching the application. Launch profiles are defined in the launchSettings.json file and are typically called Development, Staging, and Production. +/// Doesn't build the project before running this command. +/// When restoring a project with project-to-project (P2P) references, restores the root project and not the references. +/// Doesn't try to use launchSettings.json to configure the application. +/// Doesn't execute an implicit restore when running the command. +/// Specifies the target operating system (OS). This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --os linux sets the RID to linux-x64. If you use this option, don't use the -r|--runtime option. Available since .NET 6. +/// Specifies the path of the project file to run (folder name or full path). If not specified, it defaults to the current directory. +/// Specifies the target runtime to restore packages for. For a list of Runtime Identifiers (RIDs), see the RID catalog. -r short option available since .NET Core 3.0 SDK. +/// Specifies whether the terminal logger should be used for the build output. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetRun( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable<(string name, string value)> Props, + string Arch = "", + string Configuration = "", + string Framework = "", + bool? Force = default, + string LaunchProfile = "", + bool? NoBuild = default, + bool? NoDependencies = default, + bool? NoLaunchProfile = default, + bool? NoRestore = default, + string OS = "", + string Project = "", + string Runtime = "", + DotNetTerminalLogger? TerminalLogger = default, + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetRun(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetRun() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("run") + .AddArgs(Arch.ToArgs("--arch", "")) + .AddArgs(Configuration.ToArgs("--configuration", "")) + .AddArgs(Framework.ToArgs("--framework", "")) + .AddArgs(LaunchProfile.ToArgs("--launch-profile", "")) + .AddArgs(OS.ToArgs("--os", "")) + .AddArgs(Project.ToArgs("--project", "")) + .AddArgs(Runtime.ToArgs("--runtime", "")) + .AddArgs(TerminalLogger.ToArgs("--tl", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--force", Force), + ("--no-build", NoBuild), + ("--no-dependencies", NoDependencies), + ("--no-launch-profile", NoLaunchProfile), + ("--no-restore", NoRestore), + ("--diagnostics", Diagnostics) + ) + .AddProps("--property", Props.ToArray()) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "run"); +} + +/// +/// Lists the latest available version of the .NET SDK and .NET Runtime, for each feature band. +///

+/// This command makes it easier to track when new versions of the SDK and Runtimes are available. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetSdkCheck( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetSdkCheck(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetSdkCheck() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("sdk") + .AddArgs("check") + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "sdk", "check"); +} + +/// +/// Lists all projects in a solution file. +///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The solution file to use. If this argument is omitted, the command searches the current directory for one. If it finds no solution file or multiple solution files, the command fails. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetSlnList( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string Solution = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetSlnList(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetSlnList() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("sln") + .AddNotEmptyArgs(Solution.ToArg()) + .AddArgs("list") + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "sln", Solution.ToArg(), "list"); +} + +/// +/// Adds one or more projects to the solution file. +///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// The path to the project or projects to add to the solution. Unix/Linux shell globbing pattern expansions are processed correctly by the dotnet sln command. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The solution file to use. If this argument is omitted, the command searches the current directory for one. If it finds no solution file or multiple solution files, the command fails. +/// Places the projects in the root of the solution, rather than creating a solution folder. Can't be used with -s|--solution-folder. +/// The destination solution folder path to add the projects to. Can't be used with --in-root. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetSlnAdd( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable Projects, + string Solution = "", + bool? InRoot = default, + string SolutionFolder = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetSlnAdd(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetSlnAdd() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("sln") + .AddNotEmptyArgs(Solution.ToArg()) + .AddArgs("add") + .AddNotEmptyArgs(Projects.ToArray().ToArg()) + .AddArgs(SolutionFolder.ToArgs("--solution-folder", "")) + .AddBooleanArgs( + ("--in-root", InRoot), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, new [] {"sln", Solution.ToArg(), "add"}.Concat(Projects).ToArray()); +} + +/// +/// Removes a project or multiple projects from the solution file. +///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// The path to the project or projects to add to the solution. Unix/Linux shell globbing pattern expansions are processed correctly by the dotnet sln command. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The solution file to use. If this argument is omitted, the command searches the current directory for one. If it finds no solution file or multiple solution files, the command fails. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetSlnRemove( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable Projects, + string Solution = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetSlnRemove(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetSlnRemove() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("sln") + .AddNotEmptyArgs(Solution.ToArg()) + .AddArgs("remove") + .AddNotEmptyArgs(Projects.ToArray().ToArg()) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, new [] {"sln", Solution.ToArg(), "remove"}.Concat(Projects).ToArray()); +} + +/// +/// Stores the specified assemblies in the runtime package store. +///

+/// This command stores the specified assemblies in the runtime package store. By default, assemblies are optimized for the target runtime and framework. For more information, see the runtime package store topic. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// The package store manifest file is an XML file that contains the list of packages to store. The format of the manifest file is compatible with the SDK-style project format. So, a project file that references the desired packages can be used with the -m|--manifest option to store assemblies in the runtime package store. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Specifies the .NET SDK version. This option enables you to select a specific framework version beyond the framework specified by the -f|--framework option. +/// Specifies the target runtime to restore packages for. For a list of Runtime Identifiers (RIDs), see the RID catalog. -r short option available since .NET Core 3.0 SDK. +/// Specifies the .NET SDK version. This option enables you to select a specific framework version beyond the framework specified by the -f|--framework option. +/// Specifies the path to the runtime package store. If not specified, it defaults to the store subdirectory of the user profile .NET installation directory. +/// Skips the optimization phase. For more information about optimization, see Preparing a runtime environment. +/// Skips symbol generation. Currently, you can only generate symbols on Windows and Linux. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// The working directory used by the command. If not specified, it uses the obj subdirectory of the current directory. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetStore( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable Manifests, + string Framework = "", + string Runtime = "", + string FrameworkVersion = "", + string Output = "", + bool? SkipOptimization = default, + bool? SkipSymbols = default, + DotNetVerbosity? Verbosity = default, + string Directory = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetStore(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetStore() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("store") + .AddArgs(Manifests.ToArgs("--manifest", "")) + .AddArgs(Framework.ToArgs("--framework", "")) + .AddArgs(Runtime.ToArgs("--runtime", "")) + .AddArgs(FrameworkVersion.ToArgs("--framework-version", "")) + .AddArgs(Output.ToArgs("--output", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddArgs(Directory.ToArgs("--working-dir", "")) + .AddBooleanArgs( + ("--skip-optimization", SkipOptimization), + ("--skip-symbols", SkipSymbols), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "store"); +} + +/// +/// .NET test driver used to execute unit tests. +///

+/// This command is used to execute unit tests in a given solution. The dotnet test command builds the solution and runs a test host application for each test project in the solution using VSTest. The test host executes tests in the given project using a test framework, for example: MSTest, NUnit, or xUnit, and reports the success or failure of each test. If all tests are successful, the test runner returns 0 as an exit code; otherwise if any test fails, it returns 1. +///

+///

+/// For multi-targeted projects, tests are run for each targeted framework. The test host and the unit test framework are packaged as NuGet packages and are restored as ordinary dependencies for the project. Starting with the .NET 9 SDK, these tests are run in parallel by default. To disable parallel execution, set the TestTfmsInParallel MSBuild property to false. For more information, see Run tests in parallel and the example command line later in this article. +///

+/// +/// +/// new DotNetNew() +/// .WithTemplateName("mstest") +/// .WithName("MyTests") +/// .WithForce(true) +/// .Run().EnsureSuccess(); +/// +/// +/// new DotNetTest().WithWorkingDirectory("MyTests") +/// .Build().EnsureSuccess(); +/// +/// +///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// MSBuild options for setting properties. +/// Sets the value of an environment variable. Creates the variable if it does not exist, overrides if it does exist. Use of this option will force the tests to be run in an isolated process. +/// Specifies a logger for test results and optionally switches for the logger. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Path to the test project.
Or path to the solution.
Or path to a directory that contains a project or a solution.
Or path to a test project .dll file.
Or path to a test project .exe file.
If not specified, the effect is the same as using the DIRECTORY argument to specify the current directory. +/// Path to a directory to be searched for additional test adapters. Only .dll files with suffix .TestAdapter.dll are inspected. If not specified, the directory of the test .dll is searched. +/// Specifies the target architecture. This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --arch x86 sets the RID to win-x86. If you use this option, don't use the -r|--runtime option. Available since .NET 6 Preview 7. +/// All build output files from the executed command will go in subfolders under the specified path, separated by project. +/// Runs the tests in blame mode. This option is helpful in isolating problematic tests that cause the test host to crash. When a crash is detected, it creates a sequence file in TestResults/<Guid>/<Guid>_Sequence.xml that captures the order of tests that were run before the crash.<br/>This option does not create a memory dump and is not helpful when the test is hanging. +/// Runs the tests in blame mode and collects a crash dump when the test host exits unexpectedly. This option depends on the version of .NET used, the type of error, and the operating system.
For exceptions in managed code, a dump will be automatically collected on .NET 5.0 and later versions. It will generate a dump for testhost or any child process that also ran on .NET 5.0 and crashed. Crashes in native code will not generate a dump. This option works on Windows, macOS, and Linux. +/// The type of crash dump to be collected. Supported dump types are full (default), and mini. +/// Collects a crash dump on expected as well as unexpected test host exit. +/// Run the tests in blame mode and collects a hang dump when a test exceeds the given timeout. +/// The type of crash dump to be collected. It should be full, mini, or none. When none is specified, test host is terminated on timeout, but no dump is collected. +/// Per-test timeout, after which a hang dump is triggered and the test host process and all of its child processes are dumped and terminated. +/// Defines the build configuration. The default for most projects is Debug, but you can override the build configuration settings in your project. +/// Enables data collector for the test run. +/// Enables diagnostic mode for the test platform and writes diagnostic messages to the specified file and to files next to it. The process that is logging the messages determines which files are created, such as *.host_&lt;date&gt;.txt for test host log, and *.datacollector_&lt;date&gt;.txt for data collector log. +/// Builds and runs the app using the specified framework. The framework must be specified in the project file. +/// Filters tests in the current project using the given expression. Only tests that match the filter expression are run. For more information, see the Filter option details section. +/// Doesn't build the project before running this command. +/// Doesn't display the startup banner or the copyright message. +/// Doesn't execute an implicit restore when running the command. +/// Directory in which to place the built binaries. If not specified, the default path is ./bin/<configuration>/<framework>/. For projects with multiple target frameworks (via the TargetFrameworks property), you also need to define --framework when you specify this option. +/// Specifies the target operating system (OS). This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --os linux sets the RID to linux-x64. If you use this option, don't use the -r|--runtime option. Available since .NET 6. +/// The directory where the test results are going to be placed. If the specified directory doesn't exist, it's created. The default is TestResults in the directory that contains the project file. +/// The target runtime to test for. +/// The .runsettings file to use for running the tests. The TargetPlatform element (x86|x64) has no effect for dotnet test. To run tests that target x86, install the x86 version of .NET Core. The bitness of the dotnet.exe that is on the path is what will be used for running tests. +/// List the discovered tests instead of running the tests. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetTest( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable<(string name, string value)> Props, + IEnumerable<(string name, string value)> Environments, + IEnumerable Loggers, + string Project = "", + string TestAdapterPath = "", + string Arch = "", + string ArtifactsPath = "", + bool? Blame = default, + bool? BlameCrash = default, + DotNetBlameDumpType? BlameCrashDumpType = default, + bool? BlameCrashCollectAlways = default, + bool? BlameHang = default, + DotNetBlameDumpType? BlameHangDumpType = default, + TimeSpan? BlameHangTimeout = default, + string Configuration = "", + string Collect = "", + string Diag = "", + string Framework = "", + string Filter = "", + bool? NoBuild = default, + bool? NoLogo = default, + bool? NoRestore = default, + string Output = "", + string OS = "", + string ResultsDirectory = "", + string Runtime = "", + string Settings = "", + bool? ListTests = default, + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetTest(params string[] args) + : this(args, [], [], [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetTest() + : this([], [], [], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + var components = host.GetService(); + var virtualContext = components.VirtualContext; + var settings = components.DotNetSettings; + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("test") + .AddNotEmptyArgs(Project.ToArg()) + .AddMSBuildLoggers(host, Verbosity) + .AddTestLoggers(host, Loggers) + .AddArgs(Environments.ToArgs("--environment", "=")) + .AddArgs(Loggers.ToArgs("--logger ", "")) + .AddArgs("--test-adapter-path", $"{string.Join(";", new[] {TestAdapterPath, virtualContext.Resolve(settings.DotNetVSTestLoggerDirectory)}.Where(i => !string.IsNullOrWhiteSpace(i)))}") + .AddArgs(Arch.ToArgs("--arch", "")) + .AddArgs(ArtifactsPath.ToArgs("--artifacts-path", "")) + .AddArgs(BlameCrashDumpType.ToArgs("--blame-crash-dump-type", "")) + .AddArgs(BlameHangDumpType.ToArgs("--blame-hang-dump-type", "")) + .AddArgs(BlameHangTimeout.ToArgs("--blame-hang-timeout", "")) + .AddArgs(Configuration.ToArgs("--configuration", "")) + .AddArgs(Collect.ToArgs("--collect", "")) + .AddArgs(Diag.ToArgs("--diag", "")) + .AddArgs(Framework.ToArgs("--framework", "")) + .AddArgs(Filter.ToArgs("--filter", "")) + .AddArgs(Output.ToArgs("--output", "")) + .AddArgs(OS.ToArgs("--os", "")) + .AddArgs(ResultsDirectory.ToArgs("--results-directory", "")) + .AddArgs(Runtime.ToArgs("--runtime", "")) + .AddArgs(Settings.ToArgs("--settings", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--blame", Blame), + ("--blame-crash", BlameCrash), + ("--blame-crash-collect-always", BlameCrashCollectAlways), + ("--blame-hang", BlameHang), + ("--no-build", NoBuild), + ("--nologo", NoLogo), + ("--no-restore", NoRestore), + ("--list-tests", ListTests), + ("--diagnostics", Diagnostics) + ) + .AddProps("--property", Props.ToArray()) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "test", Project.ToArg()); +} + +/// +/// Installs the specified .NET tool on your machine. +///

+/// This command provides a way for you to install .NET tools on your machine. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Adds an additional NuGet package source to use during installation. Feeds are accessed in parallel, not sequentially in some order of precedence. If the same package and version is in multiple feeds, the fastest feed wins. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Name/ID of the NuGet package that contains the .NET tool to install. +/// Allow package downgrade when installing or updating a .NET tool package. Suppresses the warning, "The requested version x.x.x is lower than existing version x.x.x." +/// Specifies the target architecture. This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --arch x86 sets the RID to win-x86. If you use this option, don't use the -r|--runtime option. Available since .NET 6 Preview 7. +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// Applies to local tools. Available starting with .NET 8 SDK. To find a manifest, the search algorithm searches up the directory tree for dotnet-tools.json or a .config folder that contains a dotnet-tools.json file. If a tool-manifest can't be found and the --create-manifest-if-needed option is set to false, the CannotFindAManifestFile error occurs. If a tool-manifest can't be found and the --create-manifest-if-needed option is set to true, the tool creates a manifest automatically. +/// Prevent restoring multiple projects in parallel. +/// Specifies the target framework to install the tool for. By default, the .NET SDK tries to choose the most appropriate target framework. +/// Specifies that the installation is user wide. Can't be combined with the --tool-path option. Omitting both --global and --tool-path specifies a local tool installation. +/// Treat package source failures as warnings. +/// Update the tool and the local tool manifest. Can't be combined with the --global option or the --tool-path option. +/// Don't cache packages and HTTP requests. +/// Include prerelease packages. +/// Path to the manifest file. +/// Specifies the location where to install the Global Tool. PATH can be absolute or relative. If PATH doesn't exist, the command tries to create it. Omitting both --global and --tool-path specifies a local tool installation. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// The version of the tool to install. By default, the latest stable package version is installed. Use this option to install preview or older versions of the tool.
Starting with .NET 8.0, --version Major.Minor.Patch refers to a specific major/minor/patch version, including unlisted versions. To get the latest version of a certain major/minor version instead, use --version Major.Minor.*. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetToolInstall( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable Sources, + string Package = "", + bool? AllowDowngrade = default, + string Arch = "", + string ConfigFile = "", + bool? CreateManifestIfNeeded = default, + bool? DisableParallel = default, + string Framework = "", + bool? Global = default, + bool? IgnoreFailedSources = default, + bool? Local = default, + bool? NoCache = default, + bool? Prerelease = default, + string ToolManifest = "", + string ToolPath = "", + DotNetVerbosity? Verbosity = default, + string Version = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetToolInstall(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetToolInstall() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("tool") + .AddArgs("install") + .AddNotEmptyArgs(Package.ToArg()) + .AddArgs(Sources.ToArgs("--add-source", "")) + .AddArgs(Arch.ToArgs("--arch", "")) + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddArgs(Framework.ToArgs("--framework", "")) + .AddArgs(ToolManifest.ToArgs("--tool-manifest", "")) + .AddArgs(ToolPath.ToArgs("--tool-path", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddArgs(Version.ToArgs("--version", "")) + .AddBooleanArgs( + ("--allow-downgrade", AllowDowngrade), + ("--create-manifest-if-needed", CreateManifestIfNeeded), + ("--disable-parallel", DisableParallel), + ("--global", Global), + ("--ignore-failed-sources", IgnoreFailedSources), + ("--local", Local), + ("--no-cache", NoCache), + ("--prerelease", Prerelease), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "tool", "install", Package.ToArg()); +} + +/// +/// Lists all .NET tools of the specified type currently installed on your machine. +///

+/// This command provides a way for you to list .NET global, tool-path, or local tools installed on your machine. The command lists the package name, version installed, and the tool command. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Lists the tool that has the supplied package ID if the tool is installed. Can be used in conjunction with options. Provides a way to check if a specific tool was installed. If no tool with the specified package ID is found, the command lists headings with no detail rows. +/// Lists user-wide global tools. Can't be combined with the --tool-path option. Omitting both --global and --tool-path lists local tools. +/// Lists local tools for the current directory. Can't be combined with the --global or --tool-path options. Omitting both --global and --tool-path lists local tools even if --local is not specified. +/// Specifies a custom location where to find global tools. PATH can be absolute or relative. Can't be combined with the --global option. Omitting both --global and --tool-path lists local tools. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetToolList( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string Package = "", + bool? Global = default, + bool? Local = default, + string ToolPath = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetToolList(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetToolList() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("tool") + .AddArgs("list") + .AddNotEmptyArgs(Package.ToArg()) + .AddArgs(ToolPath.ToArgs("--tool-path", "")) + .AddBooleanArgs( + ("--global", Global), + ("--local", Local), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "tool", "list", Package.ToArg()); +} + +/// +/// Installs the .NET local tools that are in scope for the current directory. +///

+/// This command finds the tool manifest file that is in scope for the current directory and installs the tools that are listed in it. For information about manifest files, see Install a local tool and Invoke a local tool. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Adds an additional NuGet package source to use during installation. Feeds are accessed in parallel, not sequentially in some order of precedence. If the same package and version is in multiple feeds, the fastest feed wins. For more information, see What happens when a NuGet package is installed?. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// Path to the manifest file. +/// Prevent restoring multiple projects in parallel. +/// Treat package source failures as warnings. +/// Don't cache packages and HTTP requests. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetToolRestore( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable Sources, + string ConfigFile = "", + string ToolManifest = "", + bool? DisableParallel = default, + bool? IgnoreFailedSources = default, + bool? NoCache = default, + DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetToolRestore(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetToolRestore() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("tool") + .AddArgs("restore") + .AddArgs(Sources.ToArgs("--add-source", "")) + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddArgs(ToolManifest.ToArgs("--tool-manifest", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddBooleanArgs( + ("--disable-parallel", DisableParallel), + ("--ignore-failed-sources", IgnoreFailedSources), + ("--no-cache", NoCache), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "tool", "restore"); +} + +/// +/// Invokes a local tool. +///

+/// This command searches tool manifest files that are in scope for the current directory. When it finds a reference to the specified tool, it runs the tool. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// The command name of the tool to run. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetToolRun( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string CommandName = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetToolRun(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetToolRun() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("tool") + .AddArgs("run") + .AddNotEmptyArgs(CommandName.ToArg()) + .AddBooleanArgs( + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "tool", "run", CommandName.ToArg()); +} + +/// +/// Searches all .NET tools that are published to NuGet. +///

+/// This command provides a way for you to search NuGet for tools that can be used as .NET global, tool-path, or local tools. The command searches the tool names and metadata such as titles, descriptions, and tags. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Name/description of the NuGet package. +/// Shows detailed results from the query. +/// Includes pre-release packages. +/// Specifies the number of query results to skip. Used for pagination. +/// Specifies the number of query results to show. Used for pagination. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetToolSearch( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string Package = "", + bool? Detail = default, + bool? Prerelease = default, + int? Skip = default, + int? Take = default, + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetToolSearch(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetToolSearch() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("tool") + .AddArgs("search") + .AddNotEmptyArgs(Package.ToArg()) + .AddArgs(Skip.ToArgs("--skip", "")) + .AddArgs(Take.ToArgs("--take", "")) + .AddBooleanArgs( + ("--detail", Detail), + ("--prerelease", Prerelease), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "tool", "search", Package.ToArg()); +} + +/// +/// Uninstalls the specified .NET tool from your machine. +///

+/// This command provides a way for you to uninstall .NET tools from your machine. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Name/ID of the NuGet package that contains the .NET tool to uninstall. You can find the package name using the dotnet tool list command. +/// Specifies that the tool to be removed is from a user-wide installation. Can't be combined with the --tool-path option. Omitting both --global and --tool-path specifies that the tool to be removed is a local tool. +/// Specifies the location where to uninstall the tool. PATH can be absolute or relative. Can't be combined with the --global option. Omitting both --global and --tool-path specifies that the tool to be removed is a local tool. +/// Specifies the manifest file that the tool is to be removed from. PATH can be absolute or relative. Can't be combined with the --global option. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetToolUninstall( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + string Package = "", + bool? Global = default, + string ToolPath = "", + string ToolManifest = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetToolUninstall(params string[] args) + : this(args, []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetToolUninstall() + : this([], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("tool") + .AddArgs("uninstall") + .AddNotEmptyArgs(Package.ToArg()) + .AddArgs(ToolPath.ToArgs("--tool-path", "")) + .AddArgs(ToolManifest.ToArgs("--tool-manifest", "")) + .AddBooleanArgs( + ("--global", Global), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "tool", "uninstall", Package.ToArg()); +} + +/// +/// Updates the specified .NET tool on your machine. +///

+/// This command provides a way for you to update .NET tools on your machine to the latest stable version of the package. The command uninstalls and reinstalls a tool, effectively updating it. +///

+///
.NET CLI command
+///
+/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +/// Adds an additional NuGet package source to use during installation. Feeds are accessed in parallel, not sequentially in some order of precedence. If the same package and version is in multiple feeds, the fastest feed wins. +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +/// Name/ID of the NuGet package that contains the .NET global tool to update. You can find the package name using the dotnet tool list command. +/// Allow package downgrade when installing or updating a .NET tool package. Suppresses the warning, "The requested version x.x.x is lower than existing version x.x.x." +/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. +/// Prevent restoring multiple projects in parallel. +/// Specifies the target framework to update the tool for. +/// Specifies that the update is for a user-wide tool. Can't be combined with the --tool-path option. Omitting both --global and --tool-path specifies that the tool to be updated is a local tool. +/// Treat package source failures as warnings. +/// Update the tool and the local tool manifest. Can't be combined with the --global option or the --tool-path option. +/// Don't cache packages and HTTP requests. +/// Include prerelease packages. +/// Path to the manifest file. +/// Specifies the location where the global tool is installed. PATH can be absolute or relative. Can't be combined with the --global option. Omitting both --global and --tool-path specifies that the tool to be updated is a local tool. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// The version range of the tool package to update to. This cannot be used to downgrade versions, you must uninstall newer versions first.
Starting in .NET 8.0, --version Major.Minor.Patch refers to a specific major.minor.patch version, including unlisted versions. To get the latest version of a certain major.minor version instead, use --version Major.Minor.*. +/// Enables diagnostic output. +/// Specifies a short name for this operation. +[Target] +public partial record DotNetToolUpdate( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, + IEnumerable Sources, + string Package = "", + bool? AllowDowngrade = default, + string ConfigFile = "", + bool? DisableParallel = default, + string Framework = "", + bool? Global = default, + bool? IgnoreFailedSources = default, + bool? Local = default, + bool? NoCache = default, + bool? Prerelease = default, + string ToolManifest = "", + string ToolPath = "", + DotNetVerbosity? Verbosity = default, + string Version = "", + bool? Diagnostics = default, + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public DotNetToolUpdate(params string[] args) + : this(args, [], []) + { + } + + /// + /// Create a new instance of the command. + /// + public DotNetToolUpdate() + : this([], [], []) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) + .AddArgs("tool") + .AddArgs("update") + .AddNotEmptyArgs(Package.ToArg()) + .AddArgs(Sources.ToArgs("--add-source", "")) + .AddArgs(ConfigFile.ToArgs("--configfile", "")) + .AddArgs(Framework.ToArgs("--framework", "")) + .AddArgs(ToolManifest.ToArgs("--tool-manifest", "")) + .AddArgs(ToolPath.ToArgs("--tool-path", "")) + .AddArgs(Verbosity.ToArgs("--verbosity", "")) + .AddArgs(Version.ToArgs("--version", "")) + .AddBooleanArgs( + ("--allow-downgrade", AllowDowngrade), + ("--disable-parallel", DisableParallel), + ("--global", Global), + ("--ignore-failed-sources", IgnoreFailedSources), + ("--local", Local), + ("--no-cache", NoCache), + ("--prerelease", Prerelease), + ("--diagnostics", Diagnostics) + ) + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, "tool", "update", Package.ToArg()); +} diff --git a/CSharpInteractive.HostApi/DotNetCommands.tt b/CSharpInteractive.HostApi/DotNetCommands.tt new file mode 100644 index 0000000..cfa55d8 --- /dev/null +++ b/CSharpInteractive.HostApi/DotNetCommands.tt @@ -0,0 +1,1674 @@ +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Linq" #> +<#@ import namespace="System.Collections.Generic" #> +// ReSharper disable UnusedMember.Global +// ReSharper disable InconsistentNaming +namespace HostApi; +using Internal.DotNet; +using Internal; +<# + const string paraStart = "

"; + const string paraFinish = "

"; + const string exampleStart = ""; + const string exampleFinish = ""; + const string codeStart = ""; + const string codeFinish = ""; + + string CreateCliRef(string command) => + $"
.NET CLI command
"; + + var projectArg = new Arg("Project", "", "string", "The project or solution file to operate on. If not specified, the command searches the current directory for one. If more than one solution or project is found, an error is thrown.") { IsProject = true }; + var solutionArg = new Arg("Solution", "", "string", "The solution file to use. If this argument is omitted, the command searches the current directory for one. If it finds no solution file or multiple solution files, the command fails.") { IsProject = true }; + var propsArg = new Arg("Props", "--property", "IEnumerable<(string name, string value)>", "MSBuild options for setting properties.") { IsCollection = true }; + var verbosityArg = new Arg("Verbosity", "--verbosity", "DotNetVerbosity?", "Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see ."); + var diagnosticsArg = new Arg("Diagnostics", "--diagnostics", "bool?", "Enables diagnostic output."); + var pathToApplicationArg = new Arg("PathToApplication", "", "string", "Specifies the path to an application .dll file to run the application. To run the application means to find and execute the entry point, which in the case of console apps is the Main method. For example, dotnet myapp. dll runs the myapp application.") { IsProject = true }; + var rollForwardArg = new Arg("RollForward", "--roll-forward", "DotNetRollForward?", "Controls how roll forward is applied to the app. The SETTING can be one of the following values. If not specified, is the default."); + var additionalProbingPathsArg = new Arg("AdditionalProbingPaths", "--additionalprobingpath", "IEnumerable", "Paths containing probing policy and assemblies to probe.") { IsCollection = true }; + var additionalDepsArg = new Arg("AdditionalDeps", "--additional-deps", "string", "Path to an additional .deps.json file. A deps.json file contains a list of dependencies, compilation dependencies, and version information used to address assembly conflicts."); + var fxVersionArg = new Arg("FxVersion", "--fx-version", "string", "Version of the .NET runtime to use to run the application."); + var frameworkArg = new Arg("Framework", "--framework", "string", "Builds and runs the app using the specified framework. The framework must be specified in the project file."); + var configurationArg = new Arg("Configuration", "--configuration", "string", "Defines the build configuration. The default for most projects is Debug, but you can override the build configuration settings in your project."); + var runtimeArg = new Arg("Runtime", "--runtime", "string", "Specifies the target runtime to restore packages for. For a list of Runtime Identifiers (RIDs), see the RID catalog. -r short option available since .NET Core 3.0 SDK."); + var noBuildArg = new Arg("NoBuild", "--no-build", "bool?", "Doesn't build the project before running this command."); + var noRestoreArg = new Arg("NoRestore", "--no-restore", "bool?", "Doesn't execute an implicit restore when running the command."); + var noDependenciesArg = new Arg("NoDependencies", "--no-dependencies", "bool?", "When restoring a project with project-to-project (P2P) references, restores the root project and not the references."); + var noIncrementalArg = new Arg("NoIncremental", "--no-incremental", "bool?", "Marks the build as unsafe for incremental build. This flag turns off incremental compilation and forces a clean rebuild of the project's dependency graph."); + var noLogoArg = new Arg("NoLogo", "--nologo", "bool?", "Doesn't display the startup banner or the copyright message."); + var noSelfContainedArg = new Arg("NoSelfContained", "--no-self-contained", "bool?", "Publishes the application as a framework dependent application. A compatible .NET runtime must be installed on the target machine to run the application. Available since .NET 6 SDK."); + var selfContainedArg = new Arg("SelfContained", "--self-contained", "bool?", "Publishes the .NET runtime with the application so the runtime doesn't need to be installed on the target machine. The default is true if a runtime identifier is specified. Available since .NET 6."); + var forceArg = new Arg("Force", "--force", "bool?", "Forces all dependencies to be resolved even if the last restore was successful. Specifying this flag is the same as deleting the project.assets.json file."); + var archArg = new Arg("Arch", "--arch", "string", "Specifies the target architecture. This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --arch x86 sets the RID to win-x86. If you use this option, don't use the -r|--runtime option. Available since .NET 6 Preview 7."); + var osArg = new Arg("OS", "--os", "string", "Specifies the target operating system (OS). This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --os linux sets the RID to linux-x64. If you use this option, don't use the -r|--runtime option. Available since .NET 6."); + var terminalLoggerArg = new Arg("TerminalLogger", "--tl", "DotNetTerminalLogger?", "Specifies whether the terminal logger should be used for the build output."); + var artifactsPathArg = new Arg("ArtifactsPath", "--artifacts-path", "string", "All build output files from the executed command will go in subfolders under the specified path, separated by project."); + var disableBuildServersArg = new Arg("DisableBuildServers", "--disable-build-servers", "bool?", "Forces the command to ignore any persistent build servers. This option provides a consistent way to disable all use of build caching, which forces a build from scratch. A build that doesn't rely on caches is useful when the caches might be corrupted or incorrect for some reason. Available since .NET 7 SDK."); + var outputArg = new Arg("Output", "--output", "string", "Directory in which to place the built binaries. If not specified, the default path is ./bin/<configuration>/<framework>/. For projects with multiple target frameworks (via the TargetFrameworks property), you also need to define --framework when you specify this option."); + var useCurrentRuntimeArg = new Arg("UseCurrentRuntime", "--use-current-runtime", "bool?", "Sets the RuntimeIdentifier to a platform portable RuntimeIdentifier based on the one of your machine. This happens implicitly with properties that require a RuntimeIdentifier, such as SelfContained, PublishAot, PublishSelfContained, PublishSingleFile, and PublishReadyToRun. If the property is set to false, that implicit resolution will no longer occur."); + var versionSuffixArg = new Arg("VersionSuffix", "--version-suffix", "string", "Sets the value of the $(VersionSuffix) property to use when building the project. This only works if the $(Version) property isn't set. Then, $(Version) is set to the $(VersionPrefix) combined with the $(VersionSuffix), separated by a dash."); + var templateNameArg = new Arg("TemplateName", "", "string", "The template to instantiate when the command is invoked. Each template might have specific options you can pass.") { IsProject = true }; + var languageArg = new Arg("Language", "--language", "DotNetLanguage?", ""); + var ownersArg = new Arg("Owners", "--owners", "IEnumerable", "List of trusted owners to further restrict the trust of a repository.") { IsCollection = true, CollectionSeparator = ","}; + var allowUntrustedRootArg = new Arg("AllowUntrustedRoot", "--allow-untrusted-root", "bool?", "Specifies if the certificate for the trusted signer should be allowed to chain to an untrusted root. This is not recommended."); + var configFileArg = new Arg("ConfigFile", "--configfile", "string", "The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used."); + var sourcesArg = new Arg("Sources", "--source", "IEnumerable", "The URI of the NuGet package source to use during this operation.") { IsCollection = true }; + var manifestArg = new Arg("Manifests", "--manifest", "IEnumerable", "Specifies one or several target manifests to use to trim the set of packages published with the app. The manifest file is part of the output of the dotnet store command.") { IsCollection = true }; + + var commands = new Command[] + { + new( + "DotNet", + [ + "Runs a dotnet application.", + paraStart, + "You specify the path to an application .dll file to run the application. To run the application means to find and execute the entry point, which in the case of console apps is the Main method. For example, dotnet myapp.dll runs the myapp application.", + paraFinish, + CreateCliRef("dotnet") + ], + ["$PathToApplication"], + [ + additionalProbingPathsArg, + pathToApplicationArg, + additionalDepsArg, + fxVersionArg, + rollForwardArg, + diagnosticsArg + ] + ), + new( + "DotNetExec", + [ + "Executes a dotnet application.", + paraStart, + "You specify the path to an application .dll file to run the application. To run the application means to find and execute the entry point, which in the case of console apps is the Main method. For example, dotnet myapp.dll runs the myapp application.", + paraFinish, + CreateCliRef("dotnet") + ], + ["exec", "$PathToApplication"], + [ + additionalProbingPathsArg, + pathToApplicationArg, + new Arg("DepsFile", "--depsfile", "string", "Path to a deps.json file. A deps.json file is a configuration file that contains information about dependencies necessary to run the application. This file is generated by the .NET SDK."), + additionalDepsArg, + fxVersionArg, + rollForwardArg, + new Arg("RuntimeConfig", "--runtimeconfig", "string", "Path to a runtimeconfig.json file. A runtimeconfig.json file contains run-time settings and is typically named <applicationname>.runtimeconfig.json."), + diagnosticsArg + ] + ), + new( + "DotNetAddPackage", + [ + "Adds or updates a package reference in a project file.", + paraStart, + "This command provides a convenient option to add or update a package reference in a project file. When you run the command, there's a compatibility check to ensure the package is compatible with the frameworks in the project. If the check passes and the package isn't referenced in the project file, a <PackageReference> element is added to the project file. If the check passes and the package is already referenced in the project file, the <PackageReference> element is updated to the latest compatible version. After the project file is updated, dotnet restore is run.", + paraFinish, + CreateCliRef("dotnet-add-package") + ], + ["add", "$Project", "package", "$PackageName"], + [ + sourcesArg, + projectArg, + new Arg("PackageName", "", "string", "The package reference to add."), + frameworkArg with { Comments = "Adds a package reference only when targeting a specific framework." }, + noRestoreArg, + new Arg("PackageDirectory", "--package-directory", "string", @"The directory where to restore the packages. The default package restore location is %userprofile%\.nuget\packages on Windows and ~/.nuget/packages on macOS and Linux."), + new Arg("Prerelease", "--prerelease", "bool?", "Allows prerelease packages to be installed. Available since .NET Core 5 SDK."), + new Arg("Version", "--version", "string", "Version of the package"), + diagnosticsArg + ] + ), + new( + "DotNetListPackage", + [ + "Lists the package references for a project or solution.", + paraStart, + "This command provides a convenient option to list all NuGet package references for a specific project or a solution. You first need to build the project in order to have the assets needed for this command to process.", + paraFinish, + CreateCliRef("dotnet-list-package") + ], + ["list", "$Project", "package"], + [ + new Arg("Frameworks", "--framework", "IEnumerable", "Displays only the packages applicable for the specified target framework.") { IsCollection = true }, + sourcesArg, + projectArg, + new Arg("Config", "--config", "string", "The NuGet sources to use when searching for newer packages. Requires the --outdated option."), + new Arg("Deprecated", "--deprecated", "bool?", "Displays packages that have been deprecated."), + new Arg("HighestMinor", "--highest-minor", "bool?", "Considers only the packages with a matching major version number when searching for newer packages. Requires the --outdated or --deprecated option."), + new Arg("HighestPatch", "--highest-patch", "bool?", "Considers only the packages with a matching major and minor version numbers when searching for newer packages. Requires the --outdated or --deprecated option."), + new Arg("IncludePrerelease", "--include-prerelease", "bool?", "Considers packages with prerelease versions when searching for newer packages. Requires the --outdated or --deprecated option."), + new Arg("IncludeTransitive", "--include-transitive", "bool?", "Lists transitive packages, in addition to the top-level packages. When specifying this option, you get a list of packages that the top-level packages depend on."), + new Arg("Outdated", "--outdated", "bool?", "Lists packages that have newer versions available."), + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetRemovePackage", + [ + "Removes package reference from a project file.", + paraStart, + "This command provides a convenient option to remove a NuGet package reference from a project.", + paraFinish, + CreateCliRef("dotnet-remove-package") + ], + ["remove", "$Project", "package", "$PackageName"], + [ + projectArg, + new Arg("PackageName", "", "string", "The package reference to add."), + diagnosticsArg + ] + ), + new( + "DotNetAddReference", + [ + "Adds project-to-project (P2P) references.", + paraStart, + "This command provides a convenient option to add project references to a project. After running the command, the <ProjectReference> elements are added to the project file.", + paraFinish, + CreateCliRef("dotnet-add-reference") + ], + ["add", "$Project", "reference", "$References"], + [ + new Arg("References", "--source", "IEnumerable", "Project-to-project (P2P) references to add. Specify one or more projects. Glob patterns are supported on Unix/Linux-based systems.") { IsCollection = true }, + projectArg, + frameworkArg with { Comments = "Adds project references only when targeting a specific framework using the TFM format." }, + diagnosticsArg + ] + ), + new( + "DotNetListReference", + [ + "Lists project-to-project references.", + paraStart, + "This command provides a convenient option to list project references for a given project.", + paraFinish, + CreateCliRef("dotnet-list-reference") + ], + ["list", "$Project"], + [ + projectArg, + diagnosticsArg + ] + ), + new( + "DotNetRemoveReference", + [ + "Removes project-to-project (P2P) references.", + paraStart, + "This command provides a convenient option to remove project references from a project.", + paraFinish, + CreateCliRef("dotnet-remove-reference") + ], + ["remove", "$Project", "reference", "$References"], + [ + new Arg("References", "--source", "IEnumerable", "Project-to-project (P2P) references to remove. You can specify one or multiple projects. Glob patterns are supported on Unix/Linux based terminals.") { IsCollection = true }, + projectArg, + frameworkArg with { Comments = "Removes the reference only when targeting a specific framework using the TFM format." }, + diagnosticsArg + ] + ), + new( + "DotNetBuild", + [ + "Builds a project and all of its dependencies.", + paraStart, + "This command builds the project and its dependencies into a set of binaries. The binaries include the project's code in Intermediate Language (IL) files with a .dll extension. For executable projects targeting versions earlier than .NET Core 3.0, library dependencies from NuGet are typically NOT copied to the output folder. They're resolved from the NuGet global packages folder at run time. With that in mind, the product of dotnet build isn't ready to be transferred to another machine to run. To create a version of the application that can be deployed, you need to publish it (for example, with the dotnet publish command). For more information, see .NET Application Deployment.", + paraFinish, + paraStart, + "For executable projects targeting .NET Core 3.0 and later, library dependencies are copied to the output folder. This means that if there isn't any other publish-specific logic (such as Web projects have), the build output should be deployable.", + paraFinish, + exampleStart, + codeStart, + "var configuration = Props.Get(\"configuration\", \"Release\");", + "", + "", + "new DotNetBuild().WithConfiguration(configuration)", + " .Build().EnsureSuccess();", + codeFinish, + exampleFinish, + CreateCliRef("dotnet-build") + ], + ["build", "$Project"], + [ + propsArg, + sourcesArg, + projectArg, + archArg, + artifactsPathArg, + configurationArg, + disableBuildServersArg, + frameworkArg, + forceArg, + noDependenciesArg, + noIncrementalArg, + noRestoreArg, + noLogoArg, + noSelfContainedArg, + outputArg, + osArg, + runtimeArg, + selfContainedArg, + terminalLoggerArg, + verbosityArg, + useCurrentRuntimeArg, + versionSuffixArg, + diagnosticsArg + ], + CommandTypes.Build + ), + new( + "DotNetBuildServerShutdown", + [ + "Shuts down build servers that are started from dotnet.", + paraStart, + "By default, all servers are shut down.", + paraFinish, + CreateCliRef("dotnet-build-server") + ], + ["build-server", "shutdown"], + [ + new Arg("Servers", "", "IEnumerable", "Shuts down build servers that are started from dotnet. By default, all servers are shut down.") { IsCollection = true }, + diagnosticsArg + ] + ), + new( + "DotNetClean", + [ + "Cleans the output of a project.", + paraStart, + "This command cleans the output of the previous build. It's implemented as an MSBuild target, so the project is evaluated when the command is run. Only the outputs created during the build are cleaned. Both intermediate (obj) and final output (bin) folders are cleaned.", + paraFinish, + CreateCliRef("dotnet-clean") + ], + ["clean", "$Project"], + [ + propsArg, + projectArg, + artifactsPathArg, + configurationArg, + frameworkArg, + noLogoArg, + outputArg, + runtimeArg, + terminalLoggerArg, + verbosityArg, + diagnosticsArg + ], + CommandTypes.Build + ), + new( + "DotNetDevCertsHttps", + [ + "Generates a self-signed certificate to enable HTTPS use in development.", + paraStart, + "This command manages a self-signed certificate to enable HTTPS use in local web app development. Its main functions are:", + "
- Generating a certificate for use with HTTPS endpoints during development.", + "
- Trusting the generated certificate on the local machine.", + "
- Removing the generated certificate from the local machine.", + "
- Exporting a certificate in various formats so that it can be used by other tools.", + "
- Importing an existing certificate generated by the tool into the local machine.", + paraFinish, + CreateCliRef("dotnet-dev-certs") + ], + ["dev-certs", "https"], + [ + new Arg("Check", "--check", "bool?", "Checks for the existence of the development certificate but doesn't perform any action. Use this option with the --trust option to check if the certificate is not only valid but also trusted."), + new Arg("Clean", "--clean", "bool?", "Removes all HTTPS development certificates from the certificate store by using the .NET certificate store API. Doesn't remove any physical files that were created by using the --export-path option. On macOS in .NET 7.0, the dotnet dev-certs command creates the certificate on a path on disk, and the clean operation removes that certificate file."), + new Arg("ExportPath", "--export-path", "string", "Exports the certificate to a file so that it can be used by other tools. Specify the full path to the exported certificate file, including the file name."), + new Arg("Format", "--format", "string", "When used with --export-path, specifies the format of the exported certificate file. Valid values are PFX and PEM, case-insensitive. PFX is the default. The file format is independent of the file name extension. For example, if you specify --format pfx and --export-path ./cert.pem, you'll get a file named cert.pem in PFX format."), + new Arg("Import", "--import", "string", "Imports the provided HTTPS development certificate into the local machine. Requires that you also specify the --clean option, which clears out any existing HTTPS developer certificates."), + new Arg("NoPassword", "--no-password", "bool?", "Doesn't use a password for the key when exporting a certificate to PEM format files. The key file is exported in plain text. This option is not applicable to PFX files and is intended for internal testing use only."), + new Arg("Password", "--password", "bool?", "Specifies the password to use."), + new Arg("Quiet", "--quiet", "bool?", "Display warnings and errors only."), + new Arg("Trust", "--trust", "bool?", "rusts the certificate on the local machine. If this option isn't specified, the certificate is added to the certificate store but not to a trusted list. When combined with the --check option, validates that the certificate is trusted."), + new Arg("Verbose", "--verbose", "bool?", "Display debug information."), + diagnosticsArg + ] + ), + new( + "DotNetNew", + [ + "Creates a new project, configuration file, or solution based on the specified template.", + paraStart, + "This command creates a .NET project or other artifacts based on a template. The command calls the template engine to create the artifacts on disk based on the specified template and options.", + paraFinish, + exampleStart, + codeStart, + "new DotNetNew()", + " .WithTemplateName(\"console\")", + " .WithName(\"MyApp\")", + " .WithForce(true)", + " .Run().EnsureSuccess();", + codeFinish, + exampleFinish, + CreateCliRef("dotnet-new") + ], + ["new", "$TemplateName"], + [ + templateNameArg with { Comments = "The template to instantiate when the command is invoked. Each template might have specific options you can pass." }, + new Arg("DryRun", "--dry-run", "bool?", "Displays a summary of what would happen if the given command were run if it would result in a template creation. Available since .NET Core 2.2 SDK."), + new Arg("Force", "--force", "bool?", "Forces content to be generated even if it would change existing files. This is required when the template chosen would override existing files in the output directory."), + languageArg with { Comments = "The language of the template to create. The language accepted varies by the template (see defaults in the arguments section). Not valid for some templates." }, + new Arg("Name", "--name", "string", "The name for the created output. If no name is specified, the name of the current directory is used."), + frameworkArg with { Comments = "Specifies the target framework. It expects a target framework moniker (TFM). Examples: \"net6.0\", \"net7.0-macos\". This value will be reflected in the project file." }, + new Arg("NoUpdateCheck", "-no-update-check", "bool?", "Disables checking for template package updates when instantiating a template. Available since .NET SDK 6.0.100."), + outputArg with { Comments = "Location to place the generated output. The default is the current directory." }, + noRestoreArg, + new Arg("Project", "--project", "string", "The project that the template is added to. This project is used for context evaluation. If not specified, the project in the current or parent directories will be used. Available since .NET SDK 7.0.100."), + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetNewList", + [ + "Lists available templates to be run using dotnet new.", + paraStart, + "This command lists available templates to use with dotnet new. If the <TEMPLATE_NAME> is specified, lists templates containing the specified name. This option lists only default and installed templates. To find templates in NuGet that you can install locally, use the search command.", + paraFinish, + CreateCliRef("dotnet-new-list") + ], + ["new", "list", "$TemplateName"], + [ + new Arg("Columns", "--columns", "IEnumerable", "Columns to display in the output.") { IsCollection = true }, + templateNameArg with { Comments = "If the argument is specified, only the templates containing TEMPLATE_NAME in template name or short name will be shown." }, + new Arg("Author", "--author", "string", "Filters templates based on template author. Partial match is supported. Available since .NET SDK 5.0.300."), + new Arg("ColumnsAll", "--columns-all", "bool?", "Displays all columns in the output. Available since .NET SDK 5.0.300."), + new Arg("IgnoreConstraints", "--ignore-constraints", "bool?", "Disables checking if the template meets the constraints to be run. Available since .NET SDK 7.0.100."), + languageArg with { Comments = "Filters templates based on language supported by the template. The language accepted varies by the template. Not valid for some templates." }, + outputArg with { Comments = "Location to place the generated output. The default is the current directory. For the list command, it might be necessary to specify the output directory to correctly evaluate constraints for the template. Available since .NET SDK 7.0.100." }, + new Arg("Project", "--project", "string", "The project that the template is added to. For the list command, it might be needed to specify the project the template is being added to to correctly evaluate constraints for the template. Available since .NET SDK 7.0.100."), + new Arg("Tag", "--tag", "string", "Filters templates based on template tags. To be selected, a template must have at least one tag that exactly matches the criteria. Available since .NET SDK 5.0.300."), + new Arg("Type", "--type", "DotNetTemplateType?", "Filters templates based on template type."), + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetNewSearch", + [ + "Searches for the templates supported by dotnet new on NuGet.org.", + paraStart, + "This command searches for templates supported by dotnet new on NuGet.org. When the <TEMPLATE_NAME> is specified, searches for templates containing the specified name.", + paraFinish, + CreateCliRef("dotnet-new-search") + ], + ["new", "search", "$TemplateName"], + [ + new Arg("Columns", "--columns", "IEnumerable", "Columns to display in the output.") { IsCollection = true }, + templateNameArg with { Comments = "If the argument is specified, only the templates containing TEMPLATE_NAME in template name or short name will be shown." }, + new Arg("Author", "--author", "string", "Filters templates based on template author. Partial match is supported. Available since .NET SDK 5.0.300."), + new Arg("ColumnsAll", "--columns-all", "bool?", "Displays all columns in the output. Available since .NET SDK 5.0.300."), + languageArg with { Comments = "Filters templates based on language supported by the template." }, + new Arg("Package", "--package", "string", "Filters templates based on NuGet package ID. A partial match is supported."), + new Arg("Tag", "--tag", "string", "Filters templates based on template tags. To be selected, a template must have at least one tag that exactly matches the criteria."), + new Arg("Type", "--type", "DotNetTemplateType?", "Filters templates based on template type."), + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetNewDetails", + [ + "Displays template package metadata.", + paraStart, + "This command displays the metadata of the template package from the package name provided. By default, the command searches for the latest available version. If the package is installed locally or is found on the official NuGet website, it also displays the templates that the package contains, otherwise it only displays basic metadata.", + paraFinish, + CreateCliRef("dotnet-new-details") + ], + ["new", "details", "$TemplateName"], + [ + sourcesArg with { ArgName = "--add-source" }, + templateNameArg with { Comments = "If the argument is specified, only the templates containing TEMPLATE_NAME in template name or short name will be shown." }, + forceArg, + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetNewInstall", + [ + "Installs a template package.", + paraStart, + "This command installs a template package from the PATH or NUGET_ID provided. If you want to install a specific version or prerelease version of a template package, specify the version in the format <package-name>::<package-version>. By default, dotnet new passes * for the version, which represents the latest stable package version.", + paraFinish, + CreateCliRef("dotnet-new-install") + ], + ["new", "install", "$Package"], + [ + sourcesArg with { ArgName = "--add-source" }, + new Arg("Package", "", "string", "The folder on the file system or the NuGet package identifier to install the template package from. dotnet new attempts to install the NuGet package from the NuGet sources available for the current working directory and the sources specified via the --add-source option. If you want to install a specific version or prerelease version of a template package from NuGet source, specify the version in the format <package-name>::<package-version>.") { IsProject = true }, + forceArg, + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetNewUninstall", + [ + "Uninstalls a template package.", + paraStart, + "This command uninstalls a template package at the PATH or NUGET_ID provided. When the <PATH|NUGET_ID> value isn't specified, all currently installed template packages and their associated templates are displayed. When specifying NUGET_ID, don't include the version number.", + paraFinish, + CreateCliRef("dotnet-new-uninstall") + ], + ["new", "uninstall", "$Package"], + [ + new Arg("Package", "", "string", "The folder on the file system or the NuGet package identifier the package was installed from. Note that the version for the NuGet package should not be specified.") { IsProject = true }, + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetNewUpdate", + [ + "Updates installed template packages.", + paraStart, + "This command updates installed template packages. The dotnet new update command with --check-only option checks for available updates for installed template packages without applying them.", + paraFinish, + CreateCliRef("dotnet-new-update") + ], + ["new", "update"], + [ + sourcesArg with { ArgName = "--add-source" }, + new Arg("CheckOnly", "--check-only", "bool?", "Only checks for updates and displays the template packages to be updated, without applying any updates."), + new Arg("DryRun", "--dry-run", "bool?", "Only checks for updates and displays the template packages to be updated, without applying any updates."), + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetNuGetDelete", + [ + "Deletes or unlists a package from the server.", + paraStart, + "This command deletes or unlists a package from the server. For nuget.org, the action is to unlist the package.", + paraFinish, + CreateCliRef("dotnet-nuget-delete") + ], + ["nuget", "delete", "$PackageName", "$PackageVersion"], + [ + new Arg("PackageName", "", "string", "Name/ID of the package to delete.") { IsProject = true }, + new Arg("PackageVersion", "", "string", "Version of the package to delete.") { IsProject = true }, + new Arg("ForceEnglishOutput", "--force-english-output", "bool?", "Forces the application to run using an invariant, English-based culture."), + new Arg("ApiKey", "--api-key", "string", "The API key for the server."), + new Arg("NoServiceEndpoint", "--no-service-endpoint", "bool?", "Doesn't append \"api/v2/package\" to the source URL."), + new Arg("Source", "--source", "string", "Specifies the server URL. NuGet identifies a UNC or local folder source and simply copies the file there instead of pushing it using HTTP."), + diagnosticsArg + ], + CommandTypes.Default, + "--non-interactive" + ), + new( + "DotNetNuGetLocalsClear", + [ + "Clears local NuGet resources.", + paraStart, + "This command clears local NuGet resources in the http-request cache, temporary cache, or machine-wide global packages folder.", + paraFinish, + CreateCliRef("dotnet-nuget-locals") + ], + ["nuget", "locals", "$CacheLocation"], + [ + new Arg("CacheLocation", "", "NuGetCacheLocation?", "The cache location to clear.") { IsProject = true }, + new Arg("ForceEnglishOutput", "--force-english-output", "bool?", "Forces the application to run using an invariant, English-based culture."), + diagnosticsArg + ], + CommandTypes.Default, + "--clear" + ), + new( + "DotNetNuGetLocalsList", + [ + "Lists local NuGet resources.", + paraStart, + "This command lists local NuGet resources in the http-request cache, temporary cache, or machine-wide global packages folder.", + paraFinish, + CreateCliRef("dotnet-nuget-locals") + ], + ["nuget", "locals", "$CacheLocation"], + [ + new Arg("CacheLocation", "", "NuGetCacheLocation?", "The cache location to list.") { IsProject = true }, + new Arg("ForceEnglishOutput", "--force-english-output", "bool?", "Forces the application to run using an invariant, English-based culture."), + diagnosticsArg + ], + CommandTypes.Default, + "--list" + ), + new( + "DotNetNuGetPush", + [ + "Pushes a package to the server and publishes it.", + paraStart, + @"This command pushes a package to the server and publishes it. The push command uses server and credential details found in the system's NuGet config file or chain of config files. NuGet's default configuration is obtained by loading %AppData%\NuGet\NuGet.config (Windows) or $HOME/.nuget/NuGet/NuGet.Config (Linux/macOS), then loading any nuget.config or .nuget\nuget.config starting from the root of drive and ending in the current directory.", + paraFinish, + CreateCliRef("dotnet-nuget-push") + ], + ["nuget", "push", "$Package"], + [ + new Arg("Package", "", "string", "Specifies the file path to the package to be pushed.") { IsProject = true }, + new Arg("DisableBuffering", "--disable-buffering", "bool?", "Disables buffering when pushing to an HTTP(S) server to reduce memory usage."), + new Arg("ForceEnglishOutput", "--force-english-output", "bool?", "Forces the application to run using an invariant, English-based culture."), + new Arg("ApiKey", "--api-key", "string", "The API key for the server."), + new Arg("NoSymbols", "--no-symbols", "bool?", "Doesn't push symbols (even if present)."), + new Arg("NoServiceEndpoint", "--no-service-endpoint", "bool?", "Doesn't append \"api/v2/package\" to the source URL."), + new Arg("Source", "--source", "string", "Specifies the server URL. NuGet identifies a UNC or local folder source and simply copies the file there instead of pushing it using HTTP."), + new Arg("SkipDuplicate", "--skip-duplicate", "bool?", "When pushing multiple packages to an HTTP(S) server, treats any 409 Conflict response as a warning so that other pushes can continue."), + new Arg("SymbolApiKey", "--symbol-api-key", "string", "The API key for the symbol server."), + new Arg("SymbolSource", "--symbol-source", "string", "Specifies the symbol server URL."), + new Arg("Timeout", "--timeout", "int?", "Specifies the timeout for pushing to a server in seconds. Defaults to 300 seconds (5 minutes). Specifying 0 applies the default value."), + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetNuGetAddSource", + [ + "Add a NuGet source.", + paraStart, + "This command adds a new package source to your NuGet configuration files. When adding multiple package sources, be careful not to introduce a dependency confusion vulnerability.", + paraFinish, + CreateCliRef("dotnet-nuget-add-source") + ], + ["nuget", "add", "source", "$PackageSourcePath"], + [ + new Arg("ValidAuthenticationTypes", "--valid-authentication-types", "IEnumerable", "List of valid authentication types for this source. Set this to basic if the server advertises NTLM or Negotiate and your credentials must be sent using the Basic mechanism, for instance when using a PAT with on-premises Azure DevOps Server. Other valid values include negotiate, kerberos, ntlm, and digest, but these values are unlikely to be useful.") { IsCollection = true }, + new Arg("PackageSourcePath", "", "string", "Path to the package source.") { IsProject = true }, + configFileArg, + new Arg("AllowInsecureConnections", "--allow-insecure-connections", "bool?", "Allows HTTP connections for adding or updating packages. This method is not secure. Available since .NET 9 SDK."), + new Arg("Name", "--name", "string", "Name of the source."), + new Arg("Password", "--password", "string", "Password to be used when connecting to an authenticated source."), + new Arg("StorePasswordInClearText", "--store-password-in-clear-text", "bool?", "Enables storing portable package source credentials by disabling password encryption. Storing passwords in clear text is strongly discouraged."), + new Arg("Username", "--username", "string", "Username to be used when connecting to an authenticated source."), + diagnosticsArg + ] + ), + new( + "DotNetNuGetDisableSource", + [ + "Disable a NuGet source.", + paraStart, + "This command disables an existing source in your NuGet configuration files.", + paraFinish, + CreateCliRef("dotnet-nuget-disable-source") + ], + ["nuget", "disable", "source", "$Name"], + [ + new Arg("Name", "--name", "string", "Name of the source.") { IsProject = true }, + configFileArg, + diagnosticsArg + ] + ), + new( + "DotNetNuGetEnableSource", + [ + "Enable a NuGet source.", + paraStart, + "This command enables an existing source in your NuGet configuration files.", + paraFinish, + CreateCliRef("dotnet-nuget-enable-source") + ], + ["nuget", "enable", "source", "$Name"], + [ + new Arg("Name", "--name", "string", "Name of the source.") { IsProject = true }, + configFileArg, + diagnosticsArg + ] + ), + new( + "DotNetNuGetListSource", + [ + "Lists all configured NuGet sources.", + paraStart, + "This command lists all existing sources from your NuGet configuration files.", + paraFinish, + CreateCliRef("dotnet-nuget-list-source") + ], + ["nuget", "list", "source"], + [ + configFileArg, + new Arg("Format", "--format", "NuGetListFormat?", "The format of the list command output: Detailed (the default) and Short."), + diagnosticsArg + ] + ), + new( + "DotNetNuGetRemoveSource", + [ + "Remove a NuGet source.", + paraStart, + "This command removes an existing source from your NuGet configuration files.", + paraFinish, + CreateCliRef("dotnet-nuget-remove-source") + ], + ["nuget", "remove", "source", "$Name"], + [ + new Arg("Name", "--name", "string", "Name of the source.") { IsProject = true }, + configFileArg, + diagnosticsArg + ] + ), + new( + "DotNetNuGetUpdateSource", + [ + "Update a NuGet source.", + paraStart, + "This command updates an existing source in your NuGet configuration files.", + paraFinish, + CreateCliRef("dotnet-nuget-update-source") + ], + ["nuget", "update", "source", "$Name"], + [ + new Arg("ValidAuthenticationTypes", "--valid-authentication-types", "IEnumerable", "List of valid authentication types for this source. Set this to basic if the server advertises NTLM or Negotiate and your credentials must be sent using the Basic mechanism, for instance when using a PAT with on-premises Azure DevOps Server. Other valid values include negotiate, kerberos, ntlm, and digest, but these values are unlikely to be useful.") { IsCollection = true }, + new Arg("Name", "--name", "string", "Name of the source.") { IsProject = true }, + configFileArg, + new Arg("Password", "--password", "string", "Password to be used when connecting to an authenticated source."), + new Arg("Source", "--source", "string", "Path to the package source."), + new Arg("StorePasswordInClearText", "--store-password-in-clear-text", "bool?", "Enables storing portable package source credentials by disabling password encryption. Storing passwords in clear text is strongly discouraged."), + new Arg("Username", "--username", "string", "Username to be used when connecting to an authenticated source."), + diagnosticsArg + ] + ), + new( + "DotNetNuGetVerify", + [ + "Verifies a signed NuGet package.", + paraStart, + "This command verifies a signed NuGet package. This command requires a certificate root store that is valid for both code signing and timestamping. Also, this command may not be supported on some combinations of operating system and .NET SDK.", + paraFinish, + CreateCliRef("dotnet-nuget-verify") + ], + ["nuget", "verify", "$Packages"], + [ + new Arg("Packages", "", "IEnumerable", "Specifies the file path to the package(s) to be verified.") { IsCollection = true }, + new Arg("Fingerprints", "--certificate-fingerprint", "IEnumerable", "Verify that the signer certificate matches with one of the specified SHA256 fingerprints. This option can be supplied multiple times to provide multiple fingerprints.") { IsCollection = true }, + new Arg("All", "--all", "bool?", "Specifies that all verifications possible should be performed on the package(s). By default, only signatures are verified."), + configFileArg, + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetNuGetTrustList", + [ + "Lists all the trusted signers in the configuration.", + paraStart, + "This option will include all the certificates (with fingerprint and fingerprint algorithm) each signer has. If a certificate has a preceding [U], it means that certificate entry has allowUntrustedRoot set as true.", + paraFinish, + CreateCliRef("dotnet-nuget-trust#list") + ], + ["nuget", "trust", "list"], + [ + configFileArg, + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetNuGetTrustSync", + [ + "Deletes the current list of certificates and replaces them with an up-to-date list from the repository.", + CreateCliRef("dotnet-nuget-trust#sync") + ], + ["nuget", "trust", "sync", "$Name"], + [ + new Arg("Name", "", "string", "The name of the existing trusted signer to sync.") { IsProject = true }, + configFileArg, + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetNuGetTrustRemove", + [ + "Removes any trusted signers that match the given name.", + CreateCliRef("dotnet-nuget-trust#sync") + ], + ["nuget", "trust", "remove", "$Name"], + [ + new Arg("Name", "", "string", "The name of the existing trusted signer to remove.") { IsProject = true }, + configFileArg, + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetNuGetTrustAuthor", + [ + "Adds a trusted signer with the given name, based on the author signature of the package.", + CreateCliRef("dotnet-nuget-trust#author") + ], + ["nuget", "trust", "author", "$Name", "$Package"], + [ + new Arg("Name", "", "string", "The name of the trusted signer to add. If NAME already exists in the configuration, the signature is appended.") { IsProject = true }, + new Arg("Package", "", "string", "The given PACKAGE should be a local path to the signed .nupkg file.") { IsProject = true }, + allowUntrustedRootArg, + configFileArg, + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetNuGetTrustRepository", + [ + "Adds a trusted signer with the given name, based on the repository signature or countersignature of a signed package.", + CreateCliRef("dotnet-nuget-trust#repository") + ], + ["nuget", "trust", "repository", "$Name", "$Package"], + [ + ownersArg, + new Arg("Name", "", "string", "The name of the trusted signer to add. If NAME already exists in the configuration, the signature is appended.") { IsProject = true }, + new Arg("Package", "", "string", "The given PACKAGE should be a local path to the signed .nupkg file.") { IsProject = true }, + allowUntrustedRootArg, + configFileArg, + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetNuGetTrustCertificate", + [ + "Adds a trusted signer with the given name, based on a certificate fingerprint.", + CreateCliRef("dotnet-nuget-trust#certificate") + ], + ["nuget", "trust", "certificate", "$Name", "$Fingerprint"], + [ + new Arg("Name", "", "string", "The name of the trusted signer to add. If a trusted signer with the given name already exists, the certificate item is added to that signer. Otherwise a trusted author is created with a certificate item from the given certificate information.") { IsProject = true }, + new Arg("Fingerprint", "", "string", "The fingerprint of the certificate.") { IsProject = true }, + new Arg("Algorithm", "--algorithm", "NuGetCertificateAlgorithm?", "Specifies the hash algorithm used to calculate the certificate fingerprint. Defaults to SHA256. Values supported are SHA256, SHA384 and SHA512."), + allowUntrustedRootArg, + configFileArg, + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetNuGetTrustSource", + [ + "Adds a trusted signer based on a given package source.", + CreateCliRef("dotnet-nuget-trust#source") + ], + ["nuget", "trust", "source", "$Name" ], + [ + ownersArg, + new Arg("Name", "", "string", "The name of the trusted signer to add. If only <NAME> is provided without --<source-url>, the package source from your NuGet configuration files with the same name is added to the trusted list. If <NAME> already exists in the configuration, the package source is appended to it.") { IsProject = true }, + configFileArg, + new Arg("SourceUrl", "--source-url", "string", "If a source-url is provided, it must be a v3 package source URL (like https://api.nuget.org/v3/index.json). Other package source types are not supported."), + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetNuGetSign", + [ + "Signs all the NuGet packages matching the first argument with a certificate.", + paraStart, + "This command signs all the packages matching the first argument with a certificate. The certificate with the private key can be obtained from a file or from a certificate installed in a certificate store by providing a subject name or a SHA-1 fingerprint. This command requires a certificate root store that is valid for both code signing and timestamping. Also, this command may not be supported on some combinations of operating system and .NET SDK.", + paraFinish, + CreateCliRef("dotnet-nuget-sign") + ], + ["nuget", "sign", "$Packages"], + [ + new Arg("Packages", "", "IEnumerable", "Specifies the file path to the packages to be signed.") { IsProject = true, IsCollection = true }, + new Arg("CertificatePath", "--certificate-path", "string", "Specifies the file path to the certificate to be used in signing the package. This option currently supports only PKCS12 (PFX) files that contain the certificate's private key."), + new Arg("CertificateStoreName", "--certificate-store-name", "string", "Specifies the name of the X.509 certificate store to use to search for the certificate. Defaults to \"My\", the X.509 certificate store for personal certificates. This option should be used when specifying the certificate via --certificate-subject-name or --certificate-fingerprint options."), + new Arg("CertificateStoreLocation", "--certificate-store-location", "string", "Specifies the name of the X.509 certificate store use to search for the certificate. Defaults to \"CurrentUser\", the X.509 certificate store used by the current user. This option should be used when specifying the certificate via --certificate-subject-name or --certificate-fingerprint options."), + new Arg("CertificateSubjectName", "--certificate-subject-name", "string", "Specifies the subject name of the certificate used to search a local certificate store for the certificate. The search is a case-insensitive string comparison using the supplied value, which finds all certificates with the subject name containing that string, regardless of other subject values. The certificate store can be specified by --certificate-store-name and --certificate-store-location options. This option currently supports only a single matching certificate in the result. If there are multiple matching certificates in the result, or no matching certificate in the result, the sign command will fail."), + new Arg("CertificateFingerprint", "--certificate-fingerprint", "string", "Specifies the fingerprint of the certificate used to search a local certificate store for the certificate. Starting with .NET 9, this option can be used to specify the SHA-1, SHA-256, SHA-384, or SHA-512 fingerprint of the certificate. However, a NU3043 warning is raised when a SHA-1 certificate fingerprint is used because it is no longer considered secure. All the previous versions of the .NET SDK continue to accept only SHA-1 certificate fingerprint."), + new Arg("CertificatePassword", "--certificate-password", "string", "Specifies the certificate password, if needed. If a certificate is password protected but no password is provided, the sign command will fail."), + new Arg("HashAlgorithm", "--hash-algorithm", "NuGetCertificateAlgorithm?", "Hash algorithm to be used to sign the package. Defaults to SHA256. Possible values are SHA256, SHA384, and SHA512."), + new Arg("Output", "--output", "string", "Specifies the directory where the signed package should be saved. If this option isn't specified, by default the original package is overwritten by the signed package."), + new Arg("Overwrite", "--overwrite", "bool?", "Indicate that the current signature should be overwritten. By default the command will fail if the package already has a signature."), + new Arg("TimestampHashAlgorithm", "--timestamp-hash-algorithm", "NuGetCertificateAlgorithm?", "Hash algorithm to be used by the RFC 3161 timestamp server. Defaults to SHA256."), + new Arg("TimestampingServer", "--timestamper", "string", "URL to an RFC 3161 timestamping server."), + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetNuGetWhy", + [ + "Shows the dependency graph for a particular package.", + paraStart, + @"This command shows the dependency graph for a particular package for a given project or solution. Starting from the .NET 9 SDK, it's possible to pass a NuGet assets file in place of the project file, in order to use the command with projects that can't be restored with the .NET SDK. First, restore the project in Visual Studio, or msbuild.exe. By default the assets file is in the project's obj\ directory, but you can find the location with msbuild.exe path\to\project.proj -getProperty:ProjectAssetsFile. Finally, run dotnet nuget why path\to\project.assets.json SomePackage.", + paraFinish, + CreateCliRef("dotnet-nuget-why") + ], + ["nuget", "why", "$Project", "$Package"], + [ + new Arg("Frameworks", "--framework", "IEnumerable", "The target frameworks for which dependency graphs are shown.") { IsCollection = true }, + new Arg("Project", "", "string", "The project or solution file to operate on. If a directory is specified, the command searches the directory for a project or solution file. If more than one project or solution is found, an error is thrown.") { IsProject = true }, + new Arg("Package", "", "string", "The package name to look up in the dependency graph.") { IsProject = true }, + diagnosticsArg + ] + ), + new( + "DotNetNuConfigGet", + [ + "Gets the NuGet configuration settings that will be applied.", + paraStart, + "This command gets the NuGet configuration settings that will be applied from the config section.", + paraFinish, + CreateCliRef("dotnet-nuget-config-get") + ], + ["nuget", "config", "get", "$ConfigKey"], + [ + new Arg("ConfigKey", "", "string", "ALL is default value, gets all merged NuGet configuration settings from multiple NuGet configuration files that will be applied, when invoking NuGet command from the working directory path. Otherwise gets the effective value of the specified configuration settings of the config section.") { IsProject = true, DefaultValue = "\"ALL\"" }, + new Arg("ShowPath", "--show-path", "bool?", "Indicate that the NuGet configuration file path will be shown beside the configuration settings."), + new Arg("Directory", "--working-directory", "string", "Specifies the directory to start from when listing configuration files. If not specified, the current directory is used."), + diagnosticsArg + ] + ), + new( + "DotNetNuConfigSet", + [ + "Set the value of a specified NuGet configuration setting.", + paraStart, + "This command sets the values for NuGet configuration settings that will be applied from the config section.", + paraFinish, + CreateCliRef("dotnet-nuget-config-set") + ], + ["nuget", "config", "set", "$ConfigKey", "$ConfigValue"], + [ + new Arg("ConfigKey", "", "string", "The key of the settings that are to be set.") { IsProject = true }, + new Arg("ConfigValue", "", "string", "The value of the settings that are to be set.") { IsProject = true }, + configFileArg, + diagnosticsArg + ] + ), + new( + "DotNetNuConfigUnset", + [ + "Removes the key-value pair from a specified NuGet configuration setting.", + paraStart, + "This command unsets the values for NuGet configuration settings that will be applied from the config section.", + paraFinish, + CreateCliRef("dotnet-nuget-config-unset") + ], + ["nuget", "config", "unset", "$ConfigKey"], + [ + new Arg("ConfigKey", "", "string", "The key of the settings that are to be removed.") { IsProject = true }, + configFileArg, + diagnosticsArg + ] + ), + new( + "DotNetNuConfigPaths", + [ + "Lists nuget configuration files currently being appplied to a directory.", + paraStart, + "This command lists the paths to all NuGet configuration files that will be applied when invoking NuGet commands in a specific directory.", + paraFinish, + CreateCliRef("dotnet-nuget-config-paths") + ], + ["nuget", "config", "paths"], + [ + new Arg("Directory", "--working-directory", "string", "Specifies the directory to start from when listing configuration files. If not specified, the current directory is used."), + diagnosticsArg + ] + ), + new( + "DotNetPack", + [ + "Packs the code into a NuGet package.", + paraStart, + "The dotnet pack command builds the project and creates NuGet packages. The result of this command is a NuGet package (that is, a .nupkg file).", + paraFinish, + paraStart, + "NuGet dependencies of the packed project are added to the .nuspec file, so they're properly resolved when the package is installed. If the packed project has references to other projects, the other projects aren't included in the package. Currently, you must have a package per project if you have project-to-project dependencies.", + paraFinish, + paraStart, + "By default, dotnet pack builds the project first. If you wish to avoid this behavior, pass the --no-build option. This option is often useful in Continuous Integration (CI) build scenarios where you know the code was previously built.", + paraFinish, + exampleStart, + codeStart, + "new DotNetPack()", + " .Build().EnsureSuccess();", + codeFinish, + exampleFinish, + CreateCliRef("dotnet-pack") + ], + ["pack", "$Project"], + [ + propsArg, + sourcesArg, + projectArg with {Comments = "The project or solution to pack. It's either a path to a csproj, vbproj, or fsproj file, or to a solution file or directory. If not specified, the command searches the current directory for a project or solution file." }, + artifactsPathArg, + configurationArg, + forceArg, + new Arg("IncludeSource", "--include-source", "string", "Includes the debug symbols NuGet packages in addition to the regular NuGet packages in the output directory. The sources files are included in the src folder within the symbols package."), + new Arg("IncludeSymbols", "--include-symbols", "string", "Includes the debug symbols NuGet packages in addition to the regular NuGet packages in the output directory."), + noBuildArg with { Comments = "Doesn't build the project before packing. It also implicitly sets the --no-restore flag." }, + noDependenciesArg, + noIncrementalArg, + noRestoreArg, + noLogoArg, + noSelfContainedArg, + outputArg, + osArg, + runtimeArg, + selfContainedArg, + terminalLoggerArg, + verbosityArg, + useCurrentRuntimeArg, + versionSuffixArg, + diagnosticsArg + ], + CommandTypes.Build + ), + new( + "DotNetPackageSearch", + [ + "Searches for a NuGet package.", + paraStart, + "This command searches for a NuGet package.", + paraFinish, + CreateCliRef("dotnet-package-search") + ], + ["package", "search", "paths", "$SearchTerms"], + [ + sourcesArg, + new Arg("SearchTerms", "", "string", "Specifies the search term to filter results. Use this argument to search for packages matching the provided query.") { IsProject = true }, + configFileArg, + new Arg("ExactMatch", "--exact-match", "bool?", "This option narrows the search to only include packages whose IDs exactly match the specified search term, effectively filtering out any partial matches. It provides a concise list of all available versions for the identified package. Causes --take and --skip options to be ignored. Utilize this option to display all available versions of a specified package."), + new Arg("Format", "--format", "DotNetPackageSearchResultFormat?", "The format options are table and json. The default is table."), + new Arg("Prerelease", "--prerelease", "bool?", "Allow prerelease packages to be shown."), + new Arg("Skip", "--skip", "int?", "The number of results to skip, for pagination. The default value is 0."), + new Arg("Take", "--take", "int?", "The number of results to return. The default value is 20."), + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetPublish", + [ + "Publishes the application and its dependencies to a folder for deployment to a hosting system.", + paraStart, + "This command compiles the application, reads through its dependencies specified in the project file, and publishes the resulting set of files to a directory.", + paraFinish, + exampleStart, + codeStart, + "new DotNetPublish().AddProps((\"PublishDir\", \".publish\"))", + " .Build().EnsureSuccess();", + codeFinish, + exampleFinish, + CreateCliRef("dotnet-publish") + ], + ["publish", "$Project"], + [ + propsArg, + sourcesArg, + manifestArg with { Comments = "Specifies one or several target manifests to use to trim the set of packages published with the app. The manifest file is part of the output of the dotnet store command." }, + projectArg, + archArg, + artifactsPathArg, + configurationArg, + disableBuildServersArg, + frameworkArg, + forceArg, + noBuildArg with { Comments = "Doesn't build the project before publishing. It also implicitly sets the --no-restore flag." }, + noDependenciesArg, + noLogoArg, + noRestoreArg, + outputArg with { Comments = "Specifies the path for the output directory. If not specified, it defaults to [project_file_folder]/bin/[configuration]/[framework]/publish/ for a framework-dependent executable and cross-platform binaries. It defaults to [project_file_folder]/bin/[configuration]/[framework]/[runtime]/publish/ for a self-contained executable. In a web project, if the output folder is in the project folder, successive dotnet publish commands result in nested output folders. For example, if the project folder is myproject, and the publish output folder is myproject/publish, and you run dotnet publish twice, the second run puts content files such as .config and .json files in myproject/publish/publish. To avoid nesting publish folders, specify a publish folder that isn't directly under the project folder, or exclude the publish folder from the project."}, + osArg, + selfContainedArg with { Comments = "Publishes the .NET runtime with your application so the runtime doesn't need to be installed on the target machine. Default is true if a runtime identifier is specified and the project is an executable project (not a library project). For more information, see .NET application publishing and Publish .NET apps with the .NET CLI." }, + noSelfContainedArg, + runtimeArg with { Comments = "Publishes the application for a given runtime. For a list of Runtime Identifiers (RIDs), see the RID catalog. For more information, see .NET application publishing and Publish .NET apps with the .NET CLI." }, + terminalLoggerArg, + useCurrentRuntimeArg, + verbosityArg, + versionSuffixArg, + diagnosticsArg + ], + CommandTypes.Build + ), + new( + "DotNetRestore", + [ + "Restores the dependencies and tools of a project.", + paraStart, + "A .NET project typically references external libraries in NuGet packages that provide additional functionality. These external dependencies are referenced in the project file (.csproj or .vbproj). When you run the dotnet restore command, the .NET CLI uses NuGet to look for these dependencies and download them if necessary. It also ensures that all the dependencies required by the project are compatible with each other and that there are no conflicts between them. Once the command is completed, all the dependencies required by the project are available in a local cache and can be used by the .NET CLI to build and run the application.", + paraFinish, + paraStart, + "Sometimes, it might be inconvenient to run the implicit NuGet restore with these commands. For example, some automated systems, such as build systems, need to call dotnet restore explicitly to control when the restore occurs so that they can control network usage. To prevent the implicit NuGet restore, you can use the --no-restore flag with any of these commands.", + paraFinish, + exampleStart, + codeStart, + "new DotNetRestore()", + " .Build().EnsureSuccess();", + codeFinish, + exampleFinish, + CreateCliRef("dotnet-restore") + ], + ["restore", "$Project"], + [ + propsArg, + sourcesArg, + projectArg, + archArg, + configFileArg, + disableBuildServersArg, + new Arg("DisableParallel", "--disable-parallel", "bool?", "Disables restoring multiple projects in parallel."), + forceArg, + new Arg("ForceEvaluate", "--force-evaluate", "bool?", "Forces restore to reevaluate all dependencies even if a lock file already exists."), + new Arg("IgnoreFailedSources", "--ignore-failed-sources", "bool?", "Only warn about failed sources if there are packages meeting the version requirement."), + new Arg("LockFilePath", "--lock-file-path", "string", "Output location where project lock file is written. By default, this is PROJECT_ROOT\\packages.lock.json."), + new Arg("LockedMode", "--locked-mode", "bool?", "Don't allow updating project lock file."), + new Arg("NoCache", "--no-cache", "bool?", "Specifies to not cache HTTP requests."), + noDependenciesArg, + new Arg("Packages", "--packages", "string", "Specifies the directory for restored packages."), + runtimeArg, + terminalLoggerArg, + useCurrentRuntimeArg, + new Arg("UseLockFile", "--use-lock-file", "bool?", "Enables project lock file to be generated and used with restore."), + verbosityArg, + diagnosticsArg + ], + CommandTypes.Build + ), + new( + "DotNetRun", + [ + "Runs source code without any explicit compile or launch commands.", + paraStart, + "This command provides a convenient option to run your application from the source code with one command. It's useful for fast iterative development from the command line. The command depends on the dotnet build command to build the code. Any requirements for the build apply to dotnet run as well.", + paraFinish, + paraStart, + "To run the application, the dotnet run command resolves the dependencies of the application that are outside of the shared runtime from the NuGet cache. Because it uses cached dependencies, it's not recommended to use dotnet run to run applications in production. Instead, create a deployment using the dotnet publish command and deploy the published output.", + paraFinish, + exampleStart, + codeStart, + "new DotNetNew()", + " .WithTemplateName(\"console\")", + " .WithName(\"MyApp\")", + " .WithForce(true)", + " .Run().EnsureSuccess();", + "", + "", + "new DotNetRun().WithWorkingDirectory(\"MyApp\")", + " .Build().EnsureSuccess();", + codeFinish, + exampleFinish, + CreateCliRef("dotnet-run") + ], + ["run"], + [ + propsArg, + archArg, + configurationArg, + frameworkArg, + forceArg, + new Arg("LaunchProfile", "--launch-profile", "string", "The name of the launch profile (if any) to use when launching the application. Launch profiles are defined in the launchSettings.json file and are typically called Development, Staging, and Production."), + noBuildArg, + noDependenciesArg, + new Arg("NoLaunchProfile", "--no-launch-profile", "bool?", "Doesn't try to use launchSettings.json to configure the application."), + noRestoreArg, + osArg, + new Arg("Project", "--project", "string", "Specifies the path of the project file to run (folder name or full path). If not specified, it defaults to the current directory."), + runtimeArg, + terminalLoggerArg, + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetSdkCheck", + [ + "Lists the latest available version of the .NET SDK and .NET Runtime, for each feature band.", + paraStart, + "This command makes it easier to track when new versions of the SDK and Runtimes are available.", + paraFinish, + CreateCliRef("dotnet-sdk-check") + ], + ["sdk", "check"], + [ + diagnosticsArg + ] + ), + new( + "DotNetSlnList", + [ + "Lists all projects in a solution file.", + CreateCliRef("dotnet-sln#list") + ], + ["sln", "$Solution", "list"], + [ + solutionArg, + diagnosticsArg + ] + ), + new( + "DotNetSlnAdd", + [ + "Adds one or more projects to the solution file.", + CreateCliRef("dotnet-sln#add") + ], + ["sln", "$Solution", "add", "$Projects"], + [ + new Arg("Projects", "", "IEnumerable", "The path to the project or projects to add to the solution. Unix/Linux shell globbing pattern expansions are processed correctly by the dotnet sln command.") { IsProject = true, IsCollection = true }, + solutionArg, + new Arg("InRoot", "--in-root", "bool?", "Places the projects in the root of the solution, rather than creating a solution folder. Can't be used with -s|--solution-folder."), + new Arg("SolutionFolder", "--solution-folder", "string", "The destination solution folder path to add the projects to. Can't be used with --in-root."), + diagnosticsArg + ] + ), + new( + "DotNetSlnRemove", + [ + "Removes a project or multiple projects from the solution file.", + CreateCliRef("dotnet-sln#remove") + ], + ["sln", "$Solution", "remove", "$Projects"], + [ + new Arg("Projects", "", "IEnumerable", "The path to the project or projects to add to the solution. Unix/Linux shell globbing pattern expansions are processed correctly by the dotnet sln command.") { IsProject = true, IsCollection = true }, + solutionArg, + diagnosticsArg + ] + ), + new( + "DotNetStore", + [ + "Stores the specified assemblies in the runtime package store.", + paraStart, + "This command stores the specified assemblies in the runtime package store. By default, assemblies are optimized for the target runtime and framework. For more information, see the runtime package store topic.", + paraFinish, + CreateCliRef("dotnet-store") + ], + ["store"], + [ + manifestArg with { Comments = "The package store manifest file is an XML file that contains the list of packages to store. The format of the manifest file is compatible with the SDK-style project format. So, a project file that references the desired packages can be used with the -m|--manifest option to store assemblies in the runtime package store." }, + frameworkArg with { Comments = "Specifies the .NET SDK version. This option enables you to select a specific framework version beyond the framework specified by the -f|--framework option." }, + runtimeArg, + new Arg("FrameworkVersion", "--framework-version", "string", "Specifies the .NET SDK version. This option enables you to select a specific framework version beyond the framework specified by the -f|--framework option."), + outputArg with { Comments = "Specifies the path to the runtime package store. If not specified, it defaults to the store subdirectory of the user profile .NET installation directory." }, + new Arg("SkipOptimization", "--skip-optimization", "bool?", "Skips the optimization phase. For more information about optimization, see Preparing a runtime environment."), + new Arg("SkipSymbols", "--skip-symbols", "bool?", "Skips symbol generation. Currently, you can only generate symbols on Windows and Linux."), + verbosityArg, + new Arg("Directory", "--working-dir", "string", "The working directory used by the command. If not specified, it uses the obj subdirectory of the current directory."), + diagnosticsArg + ] + ), + new( + "DotNetTest", + [ + ".NET test driver used to execute unit tests.", + paraStart, + "This command is used to execute unit tests in a given solution. The dotnet test command builds the solution and runs a test host application for each test project in the solution using VSTest. The test host executes tests in the given project using a test framework, for example: MSTest, NUnit, or xUnit, and reports the success or failure of each test. If all tests are successful, the test runner returns 0 as an exit code; otherwise if any test fails, it returns 1.", + paraFinish, + paraStart, + "For multi-targeted projects, tests are run for each targeted framework. The test host and the unit test framework are packaged as NuGet packages and are restored as ordinary dependencies for the project. Starting with the .NET 9 SDK, these tests are run in parallel by default. To disable parallel execution, set the TestTfmsInParallel MSBuild property to false. For more information, see Run tests in parallel and the example command line later in this article.", + paraFinish, + exampleStart, + codeStart, + "new DotNetNew()", + " .WithTemplateName(\"mstest\")", + " .WithName(\"MyTests\")", + " .WithForce(true)", + " .Run().EnsureSuccess();", + "", + "", + "new DotNetTest().WithWorkingDirectory(\"MyTests\")", + " .Build().EnsureSuccess();", + codeFinish, + exampleFinish, + CreateCliRef("dotnet-test") + ], + ["test", "$Project"], + [ + propsArg, + new Arg("Environments", "--environment", "IEnumerable<(string name, string value)>", "Sets the value of an environment variable. Creates the variable if it does not exist, overrides if it does exist. Use of this option will force the tests to be run in an isolated process.") { IsCollection = true, CollectionSeparator = "="}, + new Arg("Loggers", "--logger ", "IEnumerable", "Specifies a logger for test results and optionally switches for the logger.") { IsCollection = true }, + projectArg with { Comments = "Path to the test project.
Or path to the solution.
Or path to a directory that contains a project or a solution.
Or path to a test project .dll file.
Or path to a test project .exe file.
If not specified, the effect is the same as using the DIRECTORY argument to specify the current directory." }, + new Arg("TestAdapterPath", "--test-adapter-path", "string", "Path to a directory to be searched for additional test adapters. Only .dll files with suffix .TestAdapter.dll are inspected. If not specified, the directory of the test .dll is searched.") { AddArgOverride = ".AddArgs(\"--test-adapter-path\", $\"{string.Join(\";\", new[] {TestAdapterPath, virtualContext.Resolve(settings.DotNetVSTestLoggerDirectory)}.Where(i => !string.IsNullOrWhiteSpace(i)))}\")" } , + archArg, + artifactsPathArg, + new Arg("Blame", "--blame", "bool?", "Runs the tests in blame mode. This option is helpful in isolating problematic tests that cause the test host to crash. When a crash is detected, it creates a sequence file in TestResults/<Guid>/<Guid>_Sequence.xml that captures the order of tests that were run before the crash.<br/>This option does not create a memory dump and is not helpful when the test is hanging."), + new Arg("BlameCrash", "--blame-crash", "bool?", "Runs the tests in blame mode and collects a crash dump when the test host exits unexpectedly. This option depends on the version of .NET used, the type of error, and the operating system.
For exceptions in managed code, a dump will be automatically collected on .NET 5.0 and later versions. It will generate a dump for testhost or any child process that also ran on .NET 5.0 and crashed. Crashes in native code will not generate a dump. This option works on Windows, macOS, and Linux."), + new Arg("BlameCrashDumpType", "--blame-crash-dump-type", "DotNetBlameDumpType?", "The type of crash dump to be collected. Supported dump types are full (default), and mini."), + new Arg("BlameCrashCollectAlways", "--blame-crash-collect-always", "bool?", "Collects a crash dump on expected as well as unexpected test host exit."), + new Arg("BlameHang", "--blame-hang", "bool?", "Run the tests in blame mode and collects a hang dump when a test exceeds the given timeout."), + new Arg("BlameHangDumpType", "--blame-hang-dump-type", "DotNetBlameDumpType?", "The type of crash dump to be collected. It should be full, mini, or none. When none is specified, test host is terminated on timeout, but no dump is collected."), + new Arg("BlameHangTimeout", "--blame-hang-timeout", "TimeSpan?", "Per-test timeout, after which a hang dump is triggered and the test host process and all of its child processes are dumped and terminated."), + configurationArg, + new Arg("Collect", "--collect", "string", "Enables data collector for the test run."), + new Arg("Diag", "--diag", "string", "Enables diagnostic mode for the test platform and writes diagnostic messages to the specified file and to files next to it. The process that is logging the messages determines which files are created, such as *.host_&lt;date&gt;.txt for test host log, and *.datacollector_&lt;date&gt;.txt for data collector log."), + frameworkArg, + new Arg("Filter", "--filter", "string", "Filters tests in the current project using the given expression. Only tests that match the filter expression are run. For more information, see the Filter option details section."), + noBuildArg, + noLogoArg, + noRestoreArg, + outputArg, + osArg, + new Arg("ResultsDirectory", "--results-directory", "string", "The directory where the test results are going to be placed. If the specified directory doesn't exist, it's created. The default is TestResults in the directory that contains the project file."), + runtimeArg with { Comments = "The target runtime to test for." }, + new Arg("Settings", "--settings", "string", "The .runsettings file to use for running the tests. The TargetPlatform element (x86|x64) has no effect for dotnet test. To run tests that target x86, install the x86 version of .NET Core. The bitness of the dotnet.exe that is on the path is what will be used for running tests."), + new Arg("ListTests", "--list-tests", "bool?", "List the discovered tests instead of running the tests."), + verbosityArg, + diagnosticsArg + ], + CommandTypes.Build | CommandTypes.Test | CommandTypes.RequiresSettings + ), + new( + "DotNetToolInstall", + [ + "Installs the specified .NET tool on your machine.", + paraStart, + "This command provides a way for you to install .NET tools on your machine.", + paraFinish, + CreateCliRef("dotnet-tool-install") + ], + ["tool", "install", "$Package"], + [ + sourcesArg with { ArgName = "--add-source", Comments = "Adds an additional NuGet package source to use during installation. Feeds are accessed in parallel, not sequentially in some order of precedence. If the same package and version is in multiple feeds, the fastest feed wins." }, + new Arg("Package", "", "string", "Name/ID of the NuGet package that contains the .NET tool to install.") { IsProject = true }, + new Arg("AllowDowngrade", "--allow-downgrade", "bool?", "Allow package downgrade when installing or updating a .NET tool package. Suppresses the warning, \"The requested version x.x.x is lower than existing version x.x.x.\""), + archArg, + configFileArg, + new Arg("CreateManifestIfNeeded", "--create-manifest-if-needed", "bool?", "Applies to local tools. Available starting with .NET 8 SDK. To find a manifest, the search algorithm searches up the directory tree for dotnet-tools.json or a .config folder that contains a dotnet-tools.json file. If a tool-manifest can't be found and the --create-manifest-if-needed option is set to false, the CannotFindAManifestFile error occurs. If a tool-manifest can't be found and the --create-manifest-if-needed option is set to true, the tool creates a manifest automatically."), + new Arg("DisableParallel", "--disable-parallel", "bool?", "Prevent restoring multiple projects in parallel."), + frameworkArg with { Comments = "Specifies the target framework to install the tool for. By default, the .NET SDK tries to choose the most appropriate target framework." }, + new Arg("Global", "--global", "bool?", "Specifies that the installation is user wide. Can't be combined with the --tool-path option. Omitting both --global and --tool-path specifies a local tool installation."), + new Arg("IgnoreFailedSources", "--ignore-failed-sources", "bool?", "Treat package source failures as warnings."), + new Arg("Local", "--local", "bool?", "Update the tool and the local tool manifest. Can't be combined with the --global option or the --tool-path option."), + new Arg("NoCache", "--no-cache", "bool?", "Don't cache packages and HTTP requests."), + new Arg("Prerelease", "--prerelease", "bool?", "Include prerelease packages."), + new Arg("ToolManifest", "--tool-manifest", "string", "Path to the manifest file."), + new Arg("ToolPath", "--tool-path", "string", "Specifies the location where to install the Global Tool. PATH can be absolute or relative. If PATH doesn't exist, the command tries to create it. Omitting both --global and --tool-path specifies a local tool installation."), + verbosityArg, + new Arg("Version", "--version", "string", "The version of the tool to install. By default, the latest stable package version is installed. Use this option to install preview or older versions of the tool.
Starting with .NET 8.0, --version Major.Minor.Patch refers to a specific major/minor/patch version, including unlisted versions. To get the latest version of a certain major/minor version instead, use --version Major.Minor.*."), + diagnosticsArg + ] + ), + new( + "DotNetToolList", + [ + "Lists all .NET tools of the specified type currently installed on your machine.", + paraStart, + "This command provides a way for you to list .NET global, tool-path, or local tools installed on your machine. The command lists the package name, version installed, and the tool command.", + paraFinish, + CreateCliRef("dotnet-tool-list") + ], + ["tool", "list", "$Package"], + [ + new Arg("Package", "", "string", "Lists the tool that has the supplied package ID if the tool is installed. Can be used in conjunction with options. Provides a way to check if a specific tool was installed. If no tool with the specified package ID is found, the command lists headings with no detail rows.") { IsProject = true }, + new Arg("Global", "--global", "bool?", "Lists user-wide global tools. Can't be combined with the --tool-path option. Omitting both --global and --tool-path lists local tools."), + new Arg("Local", "--local", "bool?", "Lists local tools for the current directory. Can't be combined with the --global or --tool-path options. Omitting both --global and --tool-path lists local tools even if --local is not specified."), + new Arg("ToolPath", "--tool-path", "string", "Specifies a custom location where to find global tools. PATH can be absolute or relative. Can't be combined with the --global option. Omitting both --global and --tool-path lists local tools."), + diagnosticsArg + ] + ), + new( + "DotNetToolRestore", + [ + "Installs the .NET local tools that are in scope for the current directory.", + paraStart, + "This command finds the tool manifest file that is in scope for the current directory and installs the tools that are listed in it. For information about manifest files, see Install a local tool and Invoke a local tool.", + paraFinish, + CreateCliRef("dotnet-tool-restore") + ], + ["tool", "restore"], + [ + sourcesArg with { ArgName = "--add-source", Comments = "Adds an additional NuGet package source to use during installation. Feeds are accessed in parallel, not sequentially in some order of precedence. If the same package and version is in multiple feeds, the fastest feed wins. For more information, see What happens when a NuGet package is installed?." }, + configFileArg, + new Arg("ToolManifest", "--tool-manifest", "string", "Path to the manifest file."), + new Arg("DisableParallel", "--disable-parallel", "bool?", "Prevent restoring multiple projects in parallel."), + new Arg("IgnoreFailedSources", "--ignore-failed-sources", "bool?", "Treat package source failures as warnings."), + new Arg("NoCache", "--no-cache", "bool?", "Don't cache packages and HTTP requests."), + verbosityArg, + diagnosticsArg + ] + ), + new( + "DotNetToolRun", + [ + "Invokes a local tool.", + paraStart, + "This command searches tool manifest files that are in scope for the current directory. When it finds a reference to the specified tool, it runs the tool.", + paraFinish, + CreateCliRef("dotnet-tool-run") + ], + ["tool", "run", "$CommandName"], + [ + new Arg("CommandName", "", "string", "The command name of the tool to run.") { IsProject = true }, + diagnosticsArg + ] + ), + new( + "DotNetToolSearch", + [ + "Searches all .NET tools that are published to NuGet.", + paraStart, + "This command provides a way for you to search NuGet for tools that can be used as .NET global, tool-path, or local tools. The command searches the tool names and metadata such as titles, descriptions, and tags.", + paraFinish, + CreateCliRef("dotnet-tool-search") + ], + ["tool", "search", "$Package"], + [ + new Arg("Package", "", "string", "Name/description of the NuGet package.") { IsProject = true }, + new Arg("Detail", "--detail", "bool?", "Shows detailed results from the query."), + new Arg("Prerelease", "--prerelease", "bool?", "Includes pre-release packages."), + new Arg("Skip", "--skip", "int?", "Specifies the number of query results to skip. Used for pagination."), + new Arg("Take", "--take", "int?", "Specifies the number of query results to show. Used for pagination."), + diagnosticsArg + ] + ), + new( + "DotNetToolUninstall", + [ + "Uninstalls the specified .NET tool from your machine.", + paraStart, + "This command provides a way for you to uninstall .NET tools from your machine.", + paraFinish, + CreateCliRef("dotnet-tool-uninstall") + ], + ["tool", "uninstall", "$Package"], + [ + new Arg("Package", "", "string", "Name/ID of the NuGet package that contains the .NET tool to uninstall. You can find the package name using the dotnet tool list command.") { IsProject = true }, + new Arg("Global", "--global", "bool?", "Specifies that the tool to be removed is from a user-wide installation. Can't be combined with the --tool-path option. Omitting both --global and --tool-path specifies that the tool to be removed is a local tool."), + new Arg("ToolPath", "--tool-path", "string", "Specifies the location where to uninstall the tool. PATH can be absolute or relative. Can't be combined with the --global option. Omitting both --global and --tool-path specifies that the tool to be removed is a local tool."), + new Arg("ToolManifest", "--tool-manifest", "string", "Specifies the manifest file that the tool is to be removed from. PATH can be absolute or relative. Can't be combined with the --global option."), + diagnosticsArg + ] + ), + new( + "DotNetToolUpdate", + [ + "Updates the specified .NET tool on your machine.", + paraStart, + "This command provides a way for you to update .NET tools on your machine to the latest stable version of the package. The command uninstalls and reinstalls a tool, effectively updating it. ", + paraFinish, + CreateCliRef("dotnet-tool-update") + ], + ["tool", "update", "$Package"], + [ + sourcesArg with { ArgName = "--add-source", Comments = "Adds an additional NuGet package source to use during installation. Feeds are accessed in parallel, not sequentially in some order of precedence. If the same package and version is in multiple feeds, the fastest feed wins." }, + new Arg("Package", "", "string", "Name/ID of the NuGet package that contains the .NET global tool to update. You can find the package name using the dotnet tool list command.") { IsProject = true }, + new Arg("AllowDowngrade", "--allow-downgrade", "bool?", "Allow package downgrade when installing or updating a .NET tool package. Suppresses the warning, \"The requested version x.x.x is lower than existing version x.x.x.\""), + configFileArg, + new Arg("DisableParallel", "--disable-parallel", "bool?", "Prevent restoring multiple projects in parallel."), + frameworkArg with { Comments = "Specifies the target framework to update the tool for." }, + new Arg("Global", "--global", "bool?", "Specifies that the update is for a user-wide tool. Can't be combined with the --tool-path option. Omitting both --global and --tool-path specifies that the tool to be updated is a local tool."), + new Arg("IgnoreFailedSources", "--ignore-failed-sources", "bool?", "Treat package source failures as warnings."), + new Arg("Local", "--local", "bool?", "Update the tool and the local tool manifest. Can't be combined with the --global option or the --tool-path option."), + new Arg("NoCache", "--no-cache", "bool?", "Don't cache packages and HTTP requests."), + new Arg("Prerelease", "--prerelease", "bool?", "Include prerelease packages."), + new Arg("ToolManifest", "--tool-manifest", "string", "Path to the manifest file."), + new Arg("ToolPath", "--tool-path", "string", "Specifies the location where the global tool is installed. PATH can be absolute or relative. Can't be combined with the --global option. Omitting both --global and --tool-path specifies that the tool to be updated is a local tool."), + verbosityArg, + new Arg("Version", "--version", "string", "The version range of the tool package to update to. This cannot be used to downgrade versions, you must uninstall newer versions first.
Starting in .NET 8.0, --version Major.Minor.Patch refers to a specific major.minor.patch version, including unlisted versions. To get the latest version of a certain major.minor version instead, use --version Major.Minor.*."), + diagnosticsArg + ] + ) + }; + + foreach (var command in commands) + { + var name = command.Name; + var commandArgs = new List(); + foreach (var arg in command.CommandArgs) + { + if (arg.StartsWith("$")) + { + var curArg = arg.Substring(1); + var notEmpty = command.Args.FirstOrDefault(i => i.PropertyName == curArg && i.IsCollection); + if (notEmpty is not null && !string.IsNullOrWhiteSpace(notEmpty.PropertyName)) + { + var compositeArg = $"new [] {{{string.Join(", ", commandArgs)}}}.Concat({curArg}).ToArray()"; + commandArgs.Clear(); + commandArgs.Add(compositeArg); + } + else + { + commandArgs.Add($"{curArg}.ToArg()"); + } + } + else + { + commandArgs.Add($"\"{arg}\""); + } + } +#> + +/// +<# + foreach (var comment in command.Comments) + { +#> +/// <#= comment #> +<# + } +#> +/// +/// Specifies the set of command line arguments to use when starting the tool. +/// Specifies the set of environment variables that apply to this process and its child processes. +<# + foreach (var arg in command.Args.Where(i => i.IsCollection)) + { +#> +/// <#= arg.Comments #> +<# + } +#> +/// Overrides the tool executable path. +/// Specifies the working directory for the tool to be started. +<# + foreach (var arg in command.Args.Where(i => !i.IsCollection)) + { +#> +/// <#= arg.Comments #> +<# + } +#> +/// Specifies a short name for this operation. +[Target] +public partial record <#= command.Name #>( + IEnumerable Args, + IEnumerable<(string name, string value)> Vars, +<# + var initializer = string.Join(", ", new[] {"args", "[]"}.Concat(Enumerable.Repeat("[]", command.Args.Count(i => i.IsCollection)))); + var fullInitializer = string.Join(", ", new[] {"[]", "[]"}.Concat(Enumerable.Repeat("[]", command.Args.Count(i => i.IsCollection)))); + foreach (var arg in command.Args) + { + var type = arg.Type; + var defaultValue = ""; + if (!string.IsNullOrWhiteSpace(arg.DefaultValue)) + { + defaultValue = $" = {arg.DefaultValue}"; + } + else + { + if (type == "string") + { + defaultValue = " = \"\""; + } + else + { + if (!arg.IsCollection) + { + defaultValue = " = default"; + } + } + } +#> + <#= type #> <#= arg.PropertyName #><#= defaultValue #>, +<# + } +#> + string ExecutablePath = "", + string WorkingDirectory = "", + string ShortName = "") +{ + /// + /// Create a new instance of the command. + /// + /// Specifies the set of command line arguments to use when starting the tool. + public <#= name #>(params string[] args) + : this(<#= initializer #>) + { + } + + /// + /// Create a new instance of the command. + /// + public <#= name #>() + : this(<#= fullInitializer #>) + { + } + + /// + public IStartInfo GetStartInfo(IHost host) + { + if (host == null) throw new ArgumentNullException(nameof(host)); +<# + if ((command.CommandTypes & CommandTypes.RequiresSettings) == CommandTypes.RequiresSettings) + { +#> + var components = host.GetService(); + var virtualContext = components.VirtualContext; + var settings = components.DotNetSettings; +<# + } +#> + return host.CreateCommandLine(ExecutablePath) + .WithShortName(ToString()) + .WithWorkingDirectory(WorkingDirectory) + .WithVars(Vars.ToArray()) +<# + foreach (var arg in command.CommandArgs) + { + if (arg.StartsWith("$")) + { + var notEmptyArg = arg.Substring(1); + var notEmpty = command.Args.FirstOrDefault(i => i.PropertyName == notEmptyArg && i.IsCollection); + if (notEmpty is not null && !string.IsNullOrWhiteSpace(notEmpty.PropertyName)) + { + notEmptyArg = $"{notEmptyArg}.ToArray()"; + } +#> + .AddNotEmptyArgs(<#= notEmptyArg #>.ToArg()) +<# + } + else + { +#> + .AddArgs("<#= arg #>") +<# + } + } +#> +<# + if ((command.CommandTypes & CommandTypes.Build) == CommandTypes.Build) + { +#> + .AddMSBuildLoggers(host, Verbosity) +<# + } + + if ((command.CommandTypes & CommandTypes.Test) == CommandTypes.Test) + { +#> + .AddTestLoggers(host, Loggers) +<# + } + + foreach (var additionalArg in command.AdditionalArgs) + { +#> + .AddArgs("<#= additionalArg #>") +<# + } + + foreach (var arg in command.Args.Where(i => !i.IsProject).Where(i => i.IsCollection && i.ArgName != "--property")) + { +#> + .AddArgs(<#= arg.PropertyName #>.ToArgs("<#= arg.ArgName #>", "<#= arg.CollectionSeparator #>")) +<# + } + + foreach (var arg in command.Args.Where(i => !i.IsProject).Where(i => !string.IsNullOrWhiteSpace(i.ArgName) && !i.Type.StartsWith("bool") && !i.IsCollection)) + { + if (string.IsNullOrWhiteSpace(arg.AddArgOverride)) + { +#> + .AddArgs(<#= arg.PropertyName #>.ToArgs("<#= arg.ArgName #>", "<#= arg.CollectionSeparator #>")) +<# + } + else + { +#> + <#= arg.AddArgOverride #> +<# + } + } + + var boolArgs = command.Args.Where(i => !string.IsNullOrWhiteSpace(i.ArgName) && i.Type.StartsWith("bool")).ToArray(); +#><#= boolArgs.Length > 0 ? " .AddBooleanArgs(\n": ""#><# + for (var i = 0; i < boolArgs.Length; i++) + { + var arg = boolArgs[i]; +#> + ("<#= arg.ArgName #>", <#= arg.PropertyName #>)<#= i < boolArgs.Length - 1 ? "," : "" #> +<# + } +#><#= boolArgs.Length > 0 ? " )\n": ""#><# + foreach (var arg in command.Args.Where(i => !string.IsNullOrWhiteSpace(i.ArgName) && i.IsCollection && i.ArgName == "--property").ToArray()) + { +#> + .AddProps("--property", <#= arg.PropertyName #>.ToArray()) +<# + } +#> + .AddArgs(Args.ToArray()); + } + + /// + public override string ToString() => "".GetShortName(ShortName, <#= string.Join(", ", commandArgs) #>); +} +<# + } +#> +<#+ + public record Arg( + string PropertyName, + string ArgName, + string Type, + string Comments) + { + public string PropertyName { get; } = PropertyName; + public string ArgName { get; set; } = ArgName; + public string Type { get; } = Type; + public string Comments { get; set; } = Comments; + public bool IsProject { get; set; } + public bool IsCollection { get; set; } + public string CollectionSeparator { get; set; } = ""; + public string DefaultValue { get; set; } + public string AddArgOverride { get; set; } + } + + [Flags] + public enum CommandTypes + { + Default = 0, + Build = 1, + Test = 2, + RequiresSettings = 4 + } + + public record Command( + string Name, + string[] Comments, + string[] CommandArgs, + Arg[] Args, + CommandTypes CommandTypes = CommandTypes.Default, + params string[] AdditionalArgs) + { + public string Name { get; } = Name; + public string[] Comments { get; } = Comments; + public string[] CommandArgs { get; } = CommandArgs; + public Arg[] Args { get; } = Args; + public CommandTypes CommandTypes { get; } = CommandTypes; + public string[] AdditionalArgs { get; } = AdditionalArgs; + } +#> \ No newline at end of file diff --git a/CSharpInteractive.HostApi/DotNetLanguage.cs b/CSharpInteractive.HostApi/DotNetLanguage.cs new file mode 100644 index 0000000..9cae78a --- /dev/null +++ b/CSharpInteractive.HostApi/DotNetLanguage.cs @@ -0,0 +1,53 @@ +namespace HostApi; + +/// +/// The .NET language. +/// +public enum DotNetLanguage +{ + /// + /// C# + /// + CSharp, + + /// + /// F# + /// + FSharp, + + /// + /// Visual Basic + /// + VisualBasic, + + /// + /// SQL + /// + Sql, + + /// + /// JSON + /// + Json, + + /// + /// TypeScript + /// + TypeScript +} + +internal static class DotNetLanguageExtensions +{ + // ReSharper disable once UnusedParameter.Global + public static string[] ToArgs(this DotNetLanguage? language, string name, string collectionSeparator) => + language switch + { + DotNetLanguage.CSharp => [name, "\"C#\""], + DotNetLanguage.FSharp => [name, "\"F#\""], + DotNetLanguage.VisualBasic => [name, "VB"], + DotNetLanguage.Sql => [name, "VB"], + DotNetLanguage.Json => [name, "JSON"], + DotNetLanguage.TypeScript => [name, "TypeScript"], + _ => [] + }; +} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/DotNetNew.cs b/CSharpInteractive.HostApi/DotNetNew.cs deleted file mode 100644 index b7b5e88..0000000 --- a/CSharpInteractive.HostApi/DotNetNew.cs +++ /dev/null @@ -1,57 +0,0 @@ -// ReSharper disable UnusedMember.Global -// ReSharper disable MemberCanBePrivate.Global -// ReSharper disable UnusedType.Global - -namespace HostApi; - -using Internal.DotNet; - -/// -/// The dotnet new command creates a .NET project based on a template. -/// -/// -/// var result = new DotNetNew("classlib", "-n", "MyLib", "--force") -/// .Build().EnsureSuccess(); -/// -/// -/// -/// Specifies the set of command line arguments to use when starting the tool. -/// Specifies the set of environment variables that apply to this process and its child processes. -/// Specifies a short template name, for example 'console'. -/// Overrides the tool executable path. -/// Specifies the working directory for the tool to be started. -/// Specifies a short name for this operation. -[Target] -public partial record DotNetNew( - IEnumerable Args, - IEnumerable<(string name, string value)> Vars, - string TemplateName, - string ExecutablePath = "", - string WorkingDirectory = "", - string ShortName = "") -{ - /// - /// Create a new instance of the command. - /// - /// Specifies a short template name, for example 'console'. - /// Specifies the set of command line arguments to use when starting the tool. - public DotNetNew(string templateName, params string[] args) - : this(args, [], templateName) - { } - - /// - public IStartInfo GetStartInfo(IHost host) - { - if (host == null) throw new ArgumentNullException(nameof(host)); - return host.CreateCommandLine(ExecutablePath) - .WithShortName(ToString()) - .WithWorkingDirectory(WorkingDirectory) - .WithVars(Vars.ToArray()) - .WithArgs("new", TemplateName) - .AddArgs(Args.ToArray()); - } - - /// - public override string ToString() => - (ExecutablePath == string.Empty ? "dotnet new" : Path.GetFileNameWithoutExtension(ExecutablePath)).GetShortName(ShortName, TemplateName); -} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/DotNetNewListColumn.cs b/CSharpInteractive.HostApi/DotNetNewListColumn.cs new file mode 100644 index 0000000..016d01f --- /dev/null +++ b/CSharpInteractive.HostApi/DotNetNewListColumn.cs @@ -0,0 +1,38 @@ +// ReSharper disable UnusedMember.Global +namespace HostApi; + +/// +/// +/// +public enum DotNetNewListColumn +{ + /// + /// A comma-separated list of languages supported by the template. + /// + Language, + + /// + /// The list of template tags. + /// + Tags, + + /// + /// The template author. + /// + Author, + + /// + /// The template type: project or item. + /// + Type +} + +internal static class DotNetNewListColumnExtensions +{ + // ReSharper disable once UnusedParameter.Global + public static string[] ToArgs(this IEnumerable columns, string name, string collectionSeparator) + { + var columnsStr = string.Join(",", columns.Select(i => i.ToString())); + return string.IsNullOrWhiteSpace(columnsStr) ? [] : [name, columnsStr]; + } +} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/DotNetNuGetPush.cs b/CSharpInteractive.HostApi/DotNetNuGetPush.cs deleted file mode 100644 index ffbd083..0000000 --- a/CSharpInteractive.HostApi/DotNetNuGetPush.cs +++ /dev/null @@ -1,91 +0,0 @@ -// ReSharper disable UnusedType.Global -// ReSharper disable UnusedMember.Global - -namespace HostApi; - -using Internal.DotNet; - -/// -/// The dotnet push command pushes a package to the server and publishes it. -/// -/// -/// var apiKey = Props.Get("apiKey", ""); -/// -/// -/// new DotNetNuGetPush().WithApiKey(apiKey); -/// -/// -/// -/// Specifies the set of command line arguments to use when starting the tool. -/// Specifies the set of environment variables that apply to this process and its child processes. -/// Specifies the server URL. NuGet identifies a UNC or local folder source and simply copies the file there instead of pushing it using HTTP. -/// Specifies the symbol server URL. -/// Specifies the file path to the package to be pushed. -/// Overrides the tool executable path. -/// Specifies the working directory for the tool to be started. -/// Forces the application to run using an invariant, English-based culture. -/// Specifies the timeout for pushing to a server in seconds. Defaults to 300 seconds (5 minutes). Specifying 0 applies the default value. -/// The API key for the server. -/// The API key for the symbol server. -/// Disables buffering when pushing to an HTTP(S) server to reduce memory usage. -/// Doesn't push symbols (even if present). -/// Doesn't append "api/v2/package" to the source URL. -/// When pushing multiple packages to an HTTP(S) server, treats any 409 Conflict response as a warning so that the push can continue. -/// Specifies a short name for this operation. -[Target] -public partial record DotNetNuGetPush( - IEnumerable Args, - IEnumerable<(string name, string value)> Vars, - IEnumerable Sources, - IEnumerable SymbolSources, - string Package = "", - string ExecutablePath = "", - string WorkingDirectory = "", - bool? ForceEnglishOutput = default, - int? Timeout = default, - string ApiKey = "", - string SymbolApiKey = "", - bool? DisableBuffering = default, - bool? NoSymbols = default, - bool? NoServiceEndpoint = default, - bool? SkipDuplicate = default, - string ShortName = "") -{ - /// - /// Create a new instance of the command. - /// - /// Specifies the set of command line arguments to use when starting the tool. - public DotNetNuGetPush(params string[] args) - : this(args, [], [], []) - { } - - /// - public IStartInfo GetStartInfo(IHost host) - { - if (host == null) throw new ArgumentNullException(nameof(host)); - return host.CreateCommandLine(ExecutablePath) - .WithShortName(ToString()) - .WithArgs("nuget", "push") - .AddNotEmptyArgs(Package) - .WithWorkingDirectory(WorkingDirectory) - .WithVars(Vars.ToArray()) - .AddArgs(Sources.Select(i => ("--source", (string?)i)).ToArray()) - .AddArgs(SymbolSources.Select(i => ("--symbol-source", (string?)i)).ToArray()) - .AddArgs( - ("--timeout", Timeout?.ToString()), - ("--api-key", ApiKey), - ("--symbol-api-key", SymbolApiKey) - ) - .AddBooleanArgs( - ("--force-english-output", ForceEnglishOutput), - ("--disable-buffering", DisableBuffering), - ("--no-symbols", NoSymbols), - ("--no-service-endpoint", NoServiceEndpoint), - ("--skip-duplicate", SkipDuplicate) - ) - .AddArgs(Args.ToArray()); - } - - /// - public override string ToString() => "dotnet nuget push".GetShortName(ShortName, Package); -} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/DotNetPack.cs b/CSharpInteractive.HostApi/DotNetPack.cs deleted file mode 100644 index 841fa38..0000000 --- a/CSharpInteractive.HostApi/DotNetPack.cs +++ /dev/null @@ -1,106 +0,0 @@ -// ReSharper disable UnusedType.Global -// ReSharper disable UnusedMember.Global - -namespace HostApi; - -using Internal.DotNet; - -/// -/// The dotnet pack command builds the project and creates NuGet packages. The result of this command is a NuGet package (that is, a .nupkg file). -/// -/// -/// new DotNetPack() -/// .Build() -/// .EnsureSuccess(); -/// -/// -/// -/// MSBuild options for setting properties. -/// Specifies the set of command line arguments to use when starting the tool. -/// Specifies the set of environment variables that apply to this process and its child processes. -/// Overrides the tool executable path. -/// Specifies the working directory for the tool to be started. -/// The project or solution file to pack. If a project or solution file isn't specified, MSBuild searches the current working directory for a file that has a file extension that ends in either proj or sln and uses that file. -/// Places the built packages in the directory specified. -/// Specifies the target runtime to restore packages for. For a list of Runtime Identifiers (RIDs), see the RID catalog. -/// Doesn't build the project before packing. It also implicitly sets the --no-restore flag. -/// Ignores project-to-project references and only restores the root project. -/// Includes the debug symbols NuGet packages in addition to the regular NuGet packages in the output directory. -/// Includes the debug symbols NuGet packages in addition to the regular NuGet packages in the output directory. The sources files are included in the src folder within the symbols package. -/// Sets the serviceable flag in the package. For more information, see .NET Blog: .NET Framework 4.5.1 Supports Microsoft Security Updates for .NET NuGet Libraries. -/// Doesn't display the startup banner or the copyright message. Available since .NET Core 3.0 SDK. -/// Doesn't execute an implicit restore when running the command. -/// Defines the value for the VersionSuffix MSBuild property. The effect of this property on the package version depends on the values of the Version and VersionPrefix properties. -/// Defines the build configuration. The default for most projects is Debug, but you can override the build configuration settings in your project. -/// Sets the RuntimeIdentifier to a platform portable RuntimeIdentifier based on the one of your machine. This happens implicitly with properties that require a RuntimeIdentifier, such as SelfContained, PublishAot, PublishSelfContained, PublishSingleFile, and PublishReadyToRun. If the property is set to false, that implicit resolution will no longer occur. -/// Forces all dependencies to be resolved even if the last restore was successful. Specifying this flag is the same as deleting the project.assets.json file. -/// Sets the verbosity level of the command. Allowed values are Quiet, Minimal, Normal, Detailed, and Diagnostic. The default is Minimal. For more information, see LoggerVerbosity. -/// Specifies a short name for this operation. -/// -[Target] -public partial record DotNetPack( - IEnumerable<(string name, string value)> Props, - IEnumerable Args, - IEnumerable<(string name, string value)> Vars, - string ExecutablePath = "", - string WorkingDirectory = "", - string Project = "", - string Output = "", - string Runtime = "", - bool? NoBuild = default, - bool? NoDependencies = default, - bool? IncludeSymbols = default, - bool? IncludeSource = default, - bool? Serviceable = default, - bool? NoLogo = default, - bool? NoRestore = default, - string VersionSuffix = "", - string Configuration = "", - bool? UseCurrentRuntime = default, - bool? Force = default, - DotNetVerbosity? Verbosity = default, - string ShortName = "") -{ - /// - /// Create a new instance of the command. - /// - /// Specifies the set of command line arguments to use when starting the tool. - public DotNetPack(params string[] args) - : this([], args, []) - { } - - /// - public IStartInfo GetStartInfo(IHost host) - { - if (host == null) throw new ArgumentNullException(nameof(host)); - return host.CreateCommandLine(ExecutablePath) - .WithShortName(ToString()) - .WithArgs("pack") - .AddNotEmptyArgs(Project) - .WithWorkingDirectory(WorkingDirectory) - .WithVars(Vars.ToArray()) - .AddMSBuildLoggers(host, Verbosity) - .AddArgs( - ("--output", Output), - ("--version-suffix", VersionSuffix), - ("--configuration", Configuration), - ("--runtime", Runtime) - ) - .AddBooleanArgs( - ("--no-build", NoBuild), - ("--no-dependencies", NoDependencies), - ("--include-symbols", IncludeSymbols), - ("--include-source", IncludeSource), - ("--serviceable", Serviceable), - ("--nologo", NoLogo), - ("--no-restore", NoRestore), - ("--use-current-runtime", UseCurrentRuntime), - ("--force", Force) - ) - .AddProps("-p", Props.ToArray()) - .AddArgs(Args.ToArray()); - } - - /// - public override string ToString() => "dotnet pack".GetShortName(ShortName, Project); -} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/DotNetPackageSearchResultFormat.cs b/CSharpInteractive.HostApi/DotNetPackageSearchResultFormat.cs new file mode 100644 index 0000000..08fd966 --- /dev/null +++ b/CSharpInteractive.HostApi/DotNetPackageSearchResultFormat.cs @@ -0,0 +1,17 @@ +namespace HostApi; + +/// +/// Search result format. +/// +public enum DotNetPackageSearchResultFormat +{ + /// + /// Table + /// + Table, + + /// + /// Json + /// + Json +} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/DotNetPublish.cs b/CSharpInteractive.HostApi/DotNetPublish.cs deleted file mode 100644 index 13f413d..0000000 --- a/CSharpInteractive.HostApi/DotNetPublish.cs +++ /dev/null @@ -1,117 +0,0 @@ -// ReSharper disable UnusedType.Global -// ReSharper disable InconsistentNaming -// ReSharper disable UnusedMember.Global - -namespace HostApi; - -using Internal.DotNet; - -/// -/// The dotnet publish command compiles the application, reads through its dependencies specified in the project file, and publishes the resulting set of files to a directory. -/// -/// -/// new DotNetPublish().AddProps(("PublishDir", ".publish")) -/// .Build().EnsureSuccess(); -/// -/// -/// -/// MSBuild options for setting properties. -/// Specifies the set of command line arguments to use when starting the tool. -/// Specifies the set of environment variables that apply to this process and its child processes. -/// The URI of the NuGet package source to use during the restore operation. -/// Overrides the tool executable path. -/// Specifies the working directory for the tool to be started. -/// The project or solution to publish. -/// Sets the RuntimeIdentifier to a platform portable RuntimeIdentifier based on the one of your machine. This happens implicitly with properties that require a RuntimeIdentifier, such as SelfContained, PublishAot, PublishSelfContained, PublishSingleFile, and PublishReadyToRun. If the property is set to false, that implicit resolution will no longer occur. -/// Specifies the path for the output directory. If not specified, it defaults to [project_file_folder]/bin/[configuration]/[framework]/publish/ for a framework-dependent executable and cross-platform binaries. It defaults to [project_file_folder]/bin/[configuration]/[framework]/[runtime]/publish/ for a self-contained executable.In a web project, if the output folder is in the project folder, successive dotnet publish commands result in nested output folders. -/// Specifies one or several target manifests to use to trim the set of packages published with the app. The manifest file is part of the output of the dotnet store command. To specify multiple manifests, add a --manifest option for each manifest. -/// Doesn't build the project before publishing. It also implicitly sets the --no-restore flag. -/// Ignores project-to-project references and only restores the root project. -/// Publishes the .NET runtime with your application so the runtime doesn't need to be installed on the target machine. Default is true if a runtime identifier is specified and the project is an executable project (not a library project). For more information, see .NET application publishing and Publish .NET apps with the .NET CLI. If this option is used without specifying true or false, the default is true. In that case, don't put the solution or project argument immediately after --self-contained, because true or false is expected in that position. -/// Equivalent to --self-contained false. Available since .NET Core 3.0 SDK. -/// Doesn't display the startup banner or the copyright message. Available since .NET Core 3.0 SDK. -/// Forces all dependencies to be resolved even if the last restore was successful. Specifying this flag is the same as deleting the project.assets.json file. -/// Publishes the application for the specified target framework. You must specify the target framework in the project file. -/// Publishes the application for a given runtime. For a list of Runtime Identifiers (RIDs), see the RID catalog. For more information, see .NET application publishing and Publish .NET apps with the .NET CLI. If you use this option, use --self-contained or --no-self-contained also. -/// Defines the build configuration. The default for most projects is Debug, but you can override the build configuration settings in your project. -/// Defines the version suffix to replace the asterisk (*) in the version field of the project file. -/// Doesn't execute an implicit restore when running the command. -/// Specifies the target architecture. This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --arch x86 sets the RID to win-x86. If you use this option, don&apos;t use the -r|--runtime option. Available since .NET 6 Preview 7. -/// Specifies the target operating system (OS). This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --os linux sets the RID to linux-x64. If you use this option, don't use the -r|--runtime option. Available since .NET 6. -/// Sets the verbosity level of the command. Allowed values are Quiet, Minimal, Normal, Detailed, and Diagnostic. The default is Minimal. For more information, see LoggerVerbosity. -/// Specifies a short name for this operation. -[Target] -public partial record DotNetPublish( - IEnumerable<(string name, string value)> Props, - IEnumerable Args, - IEnumerable<(string name, string value)> Vars, - IEnumerable Sources, - string ExecutablePath = "", - string WorkingDirectory = "", - string Project = "", - bool? UseCurrentRuntime = default, - string Output = "", - string Manifest = "", - bool? NoBuild = default, - bool? NoDependencies = default, - bool? SelfContained = default, - bool? NoSelfContained = default, - bool? NoLogo = default, - bool? Force = default, - string Framework = "", - string Runtime = "", - string Configuration = "", - string VersionSuffix = "", - bool? NoRestore = default, - string Arch = "", - string OS = "", - DotNetVerbosity? Verbosity = default, - string ShortName = "") -{ - /// - /// Create a new instance of the command. - /// - /// Specifies the set of command line arguments to use when starting the tool. - public DotNetPublish(params string[] args) - : this([], args, [], []) - { } - - /// - public IStartInfo GetStartInfo(IHost host) - { - if (host == null) throw new ArgumentNullException(nameof(host)); - return host.CreateCommandLine(ExecutablePath) - .WithShortName(ToString()) - .WithArgs("publish") - .AddNotEmptyArgs(Project) - .WithWorkingDirectory(WorkingDirectory) - .WithVars(Vars.ToArray()) - .AddMSBuildLoggers(host, Verbosity) - .AddArgs(Sources.Select(i => ("--source", (string?)i)).ToArray()) - .AddArgs( - ("--output", Output), - ("--manifest", Manifest), - ("--framework", Framework), - ("--runtime", Runtime), - ("--configuration", Configuration), - ("--version-suffix", VersionSuffix), - ("--arch", Arch), - ("--os", OS) - ) - .AddBooleanArgs( - ("--use-current-runtime", UseCurrentRuntime), - ("--no-build", NoBuild), - ("--no-dependencies", NoDependencies), - ("--self-contained", SelfContained), - ("--no-self-contained", NoSelfContained), - ("--nologo", NoLogo), - ("--no-restore", NoRestore), - ("--force", Force) - ) - .AddProps("-p", Props.ToArray()) - .AddArgs(Args.ToArray()); - } - - /// - public override string ToString() => "dotnet publish".GetShortName(ShortName, Project); -} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/DotNetRestore.cs b/CSharpInteractive.HostApi/DotNetRestore.cs deleted file mode 100644 index 7cd7799..0000000 --- a/CSharpInteractive.HostApi/DotNetRestore.cs +++ /dev/null @@ -1,107 +0,0 @@ -// ReSharper disable UnusedType.Global -// ReSharper disable UnusedMember.Global - -namespace HostApi; - -using Internal.DotNet; - -/// -/// The dotnet restore command uses NuGet to restore dependencies as well as project-specific tools that are specified in the project file. In most cases, you don't need to explicitly use the dotnet restore command. -/// -/// -/// new DotNetRestore() -/// .Build().EnsureSuccess(); -/// -/// -/// -/// MSBuild options for setting properties. -/// Specifies the set of command line arguments to use when starting the tool. -/// Specifies the set of environment variables that apply to this process and its child processes. -/// Specifies the URI of the NuGet package source to use during the restore operation. This setting overrides all the sources specified in the nuget.config files. -/// Overrides the tool executable path. -/// Specifies the working directory for the tool to be started. -/// Optional path to the project file to restore. -/// Specifies the directory for restored packages. -/// Use current runtime as the target runtime. -/// Disables restoring multiple projects in parallel. -/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. -/// Specifies to not cache HTTP requests. -/// Only warn about failed sources if there are packages meeting the version requirement. -/// Forces all dependencies to be resolved even if the last restore was successful. Specifying this flag is the same as deleting the project.assets.json file. -/// Specifies a runtime for the package restore. This is used to restore packages for runtimes not explicitly listed in the <RuntimeIdentifiers> tag in the .csproj file. For a list of Runtime Identifiers (RIDs), see the RID catalog. Provide multiple RIDs by specifying this option multiple times. -/// When restoring a project with project-to-project (P2P) references, restores the root project and not the references. -/// Enables project lock file to be generated and used with restore. -/// Don't allow updating project lock file. -/// Output location where project lock file is written. By default, this is PROJECT_ROOT\packages.lock.json. -/// Forces restore to reevaluate all dependencies even if a lock file already exists. -/// Sets the verbosity level of the command. Allowed values are Quiet, Minimal, Normal, Detailed, and Diagnostic. The default is Minimal. For more information, see LoggerVerbosity. -/// Specifies a short name for this operation. -[Target] -public partial record DotNetRestore( - IEnumerable<(string name, string value)> Props, - IEnumerable Args, - IEnumerable<(string name, string value)> Vars, - IEnumerable Sources, - string ExecutablePath = "", - string WorkingDirectory = "", - string Project = "", - string Packages = "", - bool? UseCurrentRuntime = default, - bool? DisableParallel = default, - string ConfigFile = "", - bool? NoCache = default, - bool? IgnoreFailedSources = default, - bool? Force = default, - string Runtime = "", - bool? NoDependencies = default, - bool? UseLockFile = default, - bool? LockedMode = default, - string LockFilePath = "", - bool? ForceEvaluate = default, - DotNetVerbosity? Verbosity = default, - string ShortName = "") -{ - /// - /// Create a new instance of the command. - /// - /// Specifies the set of command line arguments to use when starting the tool. - public DotNetRestore(params string[] args) - : this([], args, [], []) - { } - - /// - public IStartInfo GetStartInfo(IHost host) - { - if (host == null) throw new ArgumentNullException(nameof(host)); - return host.CreateCommandLine(ExecutablePath) - .WithShortName(ToString()) - .WithArgs("restore") - .AddNotEmptyArgs(Project) - .WithWorkingDirectory(WorkingDirectory) - .WithVars(Vars.ToArray()) - .AddMSBuildLoggers(host, Verbosity) - .AddArgs(Sources.Select(i => ("--source", (string?)i)).ToArray()) - .AddArgs( - ("--packages", Packages), - ("--configfile", ConfigFile), - ("--runtime", Runtime), - ("--lock-file-path", LockFilePath) - ) - .AddBooleanArgs( - ("--use-current-runtime", UseCurrentRuntime), - ("--disable-parallel", DisableParallel), - ("--no-cache", NoCache), - ("--ignore-failed-sources", IgnoreFailedSources), - ("--force", Force), - ("--no-dependencies", NoDependencies), - ("--use-lock-file", UseLockFile), - ("--locked-mode", LockedMode), - ("--force-evaluate", ForceEvaluate) - ) - .AddProps("-p", Props.ToArray()) - .AddArgs(Args.ToArray()); - } - - /// - public override string ToString() => "dotnet restore".GetShortName(ShortName, Project); -} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/DotNetRollForward.cs b/CSharpInteractive.HostApi/DotNetRollForward.cs new file mode 100644 index 0000000..705e22b --- /dev/null +++ b/CSharpInteractive.HostApi/DotNetRollForward.cs @@ -0,0 +1,38 @@ +// ReSharper disable UnusedMember.Global +namespace HostApi; + +/// +/// Controls how roll forward is applied to the app. +/// +public enum DotNetRollForward +{ + /// + /// Roll forward to the highest patch version. This disables minor version roll forward. + /// + LatestPatch, + + /// + /// Roll forward to the lowest higher minor version, if requested minor version is missing. If the requested minor version is present, then the LatestPatch policy is used. + /// + Minor, + + /// + /// Roll forward to lowest higher major version, and lowest minor version, if requested major version is missing. If the requested major version is present, then the Minor policy is used. + /// + Major, + + /// + /// Roll forward to highest minor version, even if requested minor version is present. Intended for component hosting scenarios. + /// + LatestMinor, + + /// + /// Roll forward to highest major and highest minor version, even if requested major is present. Intended for component hosting scenarios. + /// + LatestMajor, + + /// + /// Don't roll forward. Only bind to specified version. This policy isn't recommended for general use because it disables the ability to roll forward to the latest patches. This value is only recommended for testing. + /// + Disable +} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/DotNetRun.cs b/CSharpInteractive.HostApi/DotNetRun.cs deleted file mode 100644 index 66d97a9..0000000 --- a/CSharpInteractive.HostApi/DotNetRun.cs +++ /dev/null @@ -1,104 +0,0 @@ -// ReSharper disable UnusedType.Global -// ReSharper disable UnusedMember.Global -// ReSharper disable InconsistentNaming - -namespace HostApi; - -using Internal.DotNet; - -/// -/// The dotnet run command provides a convenient option to run your application from the source code with one command. It's useful for fast iterative development from the command line. The command depends on the dotnet build command to build the code. Any requirements for the build, such as that the project must be restored first, apply to dotnet run as well. -/// -/// -/// var result = new DotNetNew("console", "-n", "MyApp", "--force") -/// .Build().EnsureSuccess(); -/// -/// -/// new DotNetRun().WithWorkingDirectory("MyApp") -/// .Build().EnsureSuccess(); -/// -/// -/// -/// MSBuild options for setting properties. -/// Specifies the set of command line arguments to use when starting the application. -/// Specifies the set of environment variables that apply to this process and its child processes. -/// Overrides the tool executable path. -/// Specifies the working directory for the tool to be started. -/// Builds and runs the app using the specified framework. The framework must be specified in the project file. -/// Defines the build configuration. The default for most projects is Debug, but you can override the build configuration settings in your project. -/// Specifies the target runtime to restore packages for. For a list of Runtime Identifiers (RIDs), see the RID catalog. -r short option available since .NET Core 3.0 SDK. -/// Specifies the path of the project file to run (folder name or full path). If not specified, it defaults to the current directory. -/// The name of the launch profile (if any) to use when launching the application. Launch profiles are defined in the launchSettings.json file and are typically called Development, Staging, and Production. For more information, see Working with multiple environments. -/// Doesn't try to use launchSettings.json to configure the application. -/// Doesn't build the project before running. It also implicit sets the --no-restore flag. -/// Doesn't execute an implicit restore when running the command. -/// When restoring a project with project-to-project (P2P) references, restores the root project and not the references. -/// Forces all dependencies to be resolved even if the last restore was successful. Specifying this flag is the same as deleting the project.assets.json file. -/// Specifies the target architecture. This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --arch x86 sets the RID to win-x86. If you use this option, don't use the -r|--runtime option. Available since .NET 6 Preview 7. -/// Specifies the target operating system (OS). This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --os linux sets the RID to linux-x64. If you use this option, don't use the -r|--runtime option. Available since .NET 6. -/// Sets the verbosity level of the command. Allowed values are Quiet, Minimal, Normal, Detailed, and Diagnostic. The default is Minimal. For more information, see LoggerVerbosity. -/// Specifies a short name for this operation. -/// -[Target] -public partial record DotNetRun( - IEnumerable<(string name, string value)> Props, - IEnumerable Args, - IEnumerable<(string name, string value)> Vars, - string ExecutablePath = "", - string WorkingDirectory = "", - string Framework = "", - string Configuration = "", - string Runtime = "", - string Project = "", - string LaunchProfile = "", - bool? NoLaunchProfile = default, - bool? NoBuild = default, - bool? NoRestore = default, - bool? NoDependencies = default, - bool? Force = default, - string Arch = "", - string OS = "", - DotNetVerbosity? Verbosity = default, - string ShortName = "") -{ - /// - /// Create a new instance of the command. - /// - /// Specifies the set of command line arguments to use when starting the tool. - public DotNetRun(params string[] args) - : this([], args, []) - { } - - /// - public IStartInfo GetStartInfo(IHost host) - { - if (host == null) throw new ArgumentNullException(nameof(host)); - return host.CreateCommandLine(ExecutablePath) - .WithShortName(ToString()) - .WithArgs("run") - .WithWorkingDirectory(WorkingDirectory) - .WithVars(Vars.ToArray()) - .AddArgs( - ("--framework", Framework), - ("--configuration", Configuration), - ("--runtime", Runtime), - ("--project", Project), - ("--launch-profile", LaunchProfile), - ("--verbosity", Verbosity?.ToString().ToLowerInvariant()), - ("--arch", Arch), - ("--os", OS) - ) - .AddBooleanArgs( - ("--no-launch-profile", NoLaunchProfile), - ("--no-build", NoBuild), - ("--no-restore", NoRestore), - ("--no-dependencies", NoDependencies), - ("--force", Force) - ) - .AddProps("--property", Props.ToArray()) - .AddArgs(Args.ToArray()); - } - - /// - public override string ToString() => "dotnet run".GetShortName(ShortName, Project); -} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/DotNetTemplateType.cs b/CSharpInteractive.HostApi/DotNetTemplateType.cs new file mode 100644 index 0000000..73b3ba6 --- /dev/null +++ b/CSharpInteractive.HostApi/DotNetTemplateType.cs @@ -0,0 +1,23 @@ +// ReSharper disable UnusedMember.Global +namespace HostApi; + +/// +/// Template type. +/// +public enum DotNetTemplateType +{ + /// + /// Project + /// + Project, + + /// + /// Item + /// + Item, + + /// + /// Solution + /// + Solution +} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/DotNetTerminalLogger.cs b/CSharpInteractive.HostApi/DotNetTerminalLogger.cs new file mode 100644 index 0000000..44d1b9c --- /dev/null +++ b/CSharpInteractive.HostApi/DotNetTerminalLogger.cs @@ -0,0 +1,23 @@ +// ReSharper disable UnusedMember.Global +namespace HostApi; + +/// +/// Terminal logger modes. +/// +public enum DotNetTerminalLogger +{ + /// + /// First verifies the environment before enabling terminal logging. + /// + Auto, + + /// + /// Skips the environment check and enables terminal logging. + /// + On, + + /// + /// Skips the environment check and uses the default console logger. + /// + Off +} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/DotNetTest.cs b/CSharpInteractive.HostApi/DotNetTest.cs deleted file mode 100644 index b13c2bc..0000000 --- a/CSharpInteractive.HostApi/DotNetTest.cs +++ /dev/null @@ -1,164 +0,0 @@ -// ReSharper disable UnusedType.Global -// ReSharper disable UnusedMember.Global -// ReSharper disable InconsistentNaming -// ReSharper disable CommentTypo - -namespace HostApi; - -using Internal; -using Internal.DotNet; - -/// -/// The dotnet test command is used to execute unit tests in a given solution. The dotnet test command builds the solution and runs a test host application for each test project in the solution. The test host executes tests in the given project using a test framework, for example: MSTest, NUnit, or xUnit, and reports the success or failure of each test. If all tests are successful, the test runner returns 0 as an exit code; otherwise if any test fails, it returns 1. -/// -/// -/// new DotNetNew("mstest", "-n", "MyTests", "--force") -/// .Build().EnsureSuccess(); -/// -/// -/// new DotNetTest().WithWorkingDirectory("MyTests") -/// .Build().EnsureSuccess(); -/// -/// -/// -/// MSBuild options for setting properties. -/// Specifies the set of command line arguments to use when starting the tool. -/// Specifies the set of environment variables that apply to this process and its child processes. -/// Specifies RunSettings passed to tests. -/// Specifies a logger for test results. Use "console;verbosity=detailed". Specify the parameter multiple times to enable multiple loggers. -/// Overrides the tool executable path. -/// Specifies the working directory for the tool to be started. -/// Path to the test project, to the solution, to a directory that contains a project or a solution or to a test project .dll file. -/// The .runsettings file to use for running the tests. The TargetPlatform element (x86|x64) has no effect for dotnet test. To run tests that target x86, install the x86 version of .NET Core. The bitness of the dotnet.exe that is on the path is what will be used for running tests. -/// List the discovered tests instead of running the tests. -/// Filters out tests in the current project using the given expression. For more information, see the Filter option details section. For more information and examples on how to use selective unit test filtering, see Running selective unit tests. -/// Path to a directory to be searched for additional test adapters. Only .dll files with suffix .TestAdapter.dll are inspected. If not specified, the directory of the test .dll is searched. -/// Defines the build configuration. The default for most projects is Debug, but you can override the build configuration settings in your project. -/// Forces the use of dotnet or .NET Framework test host for the test binaries. This option only determines which type of host to use. The actual framework version to be used is determined by the runtimeconfig.json of the test project. When not specified, the TargetFramework assembly attribute is used to determine the type of host. When that attribute is stripped from the .dll, the .NET Framework host is used. -/// The target runtime to test for. -/// Directory in which to find the binaries to run. If not specified, the default path is ./bin/<configuration>/<framework>/. For projects with multiple target frameworks (via the TargetFrameworks property), you also need to define --framework when you specify this option. dotnet test always runs tests from the output directory. You can use AppDomain.BaseDirectory to consume test assets in the output directory. -/// Enables diagnostic mode for the test platform and writes diagnostic messages to the specified file and to files next to it. The process that is logging the messages determines which files are created, such as *.host_<date>.txt for test host log, and *.datacollector_<date>.txt for data collector log. -/// Doesn't build the test project before running it. It also implicitly sets the - --no-restore flag. -/// The directory where the test results are going to be placed. If the specified directory doesn't exist, it's created. The default is TestResults in the directory that contains the project file. -/// Enables data collector for the test run. For more information, see Monitor and analyze test run. -/// Runs the tests in blame mode. This option is helpful in isolating problematic tests that cause the test host to crash. When a crash is detected, it creates a sequence file in TestResults/<Guid>/<Guid>_Sequence.xml that captures the order of tests that were run before the crash. -/// Runs the tests in blame mode and collects a crash dump when the test host exits unexpectedly. This option depends on the version of .NET used, the type of error, and the operating system. -/// The type of crash dump to be collected. Implies BlameCrash. -/// Collects a crash dump on expected as well as unexpected test host exit. -/// Run the tests in blame mode and collects a hang dump when a test exceeds the given timeout. -/// The type of crash dump to be collected. It should be full, mini, or none. When none is specified, test host is terminated on timeout, but no dump is collected. Implies BlameHang. -/// Per-test timeout, after which a hang dump is triggered and the test host process and all of its child processes are dumped and terminated. -/// Run tests without displaying the Microsoft TestPlatform banner. Available since .NET Core 3.0 SDK. -/// Doesn't execute an implicit restore when running the command. -/// Specifies the target architecture. This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --arch x86 sets the RID to win-x86. If you use this option, don't use the -r|--runtime option. Available since .NET 6 Preview 7. -/// Specifies the target operating system (OS). This is a shorthand syntax for setting the Runtime Identifier (RID), where the provided value is combined with the default RID. For example, on a win-x64 machine, specifying --os linux sets the RID to linux-x64. If you use this option, don't use the -r|--runtime option. Available since .NET 6. -/// Sets the verbosity level of the command. Allowed values are Quiet, Minimal, Normal, Detailed, and Diagnostic. The default is Minimal. For more information, see LoggerVerbosity. -/// Specifies a short name for this operation. -[Target] -public partial record DotNetTest( - IEnumerable<(string name, string value)> Props, - IEnumerable Args, - IEnumerable<(string name, string value)> Vars, - IEnumerable<(string name, string value)> RunSettings, - IEnumerable Loggers, - string ExecutablePath = "", - string WorkingDirectory = "", - string Project = "", - string Settings = "", - bool? ListTests = default, - string Filter = "", - string TestAdapterPath = "", - string Configuration = "", - string Framework = "", - string Runtime = "", - string Output = "", - string Diag = "", - bool? NoBuild = default, - string ResultsDirectory = "", - string Collect = "", - bool? Blame = default, - bool? BlameCrash = default, - string BlameCrashDumpType = "", - bool? BlameCrashCollectAlways = default, - bool? BlameHang = default, - string BlameHangDumpType = "", - TimeSpan? BlameHangTimeout = default, - bool? NoLogo = default, - bool? NoRestore = default, - string Arch = "", - string OS = "", - DotNetVerbosity? Verbosity = default, - string ShortName = "") -{ - /// - /// Create a new instance of the command. - /// - /// Specifies the set of command line arguments to use when starting the tool. - public DotNetTest(params string[] args) - : this([], args, [], [], []) - { } - - /// - public IStartInfo GetStartInfo(IHost host) - { - if (host == null) throw new ArgumentNullException(nameof(host)); - var blameHangTimeout = BlameHangTimeout?.TotalMilliseconds; - // ReSharper disable once UseDeconstruction - var components = host.GetService(); - var virtualContext = components.VirtualContext; - var settings = components.DotNetSettings; - var cmd = host.CreateCommandLine(ExecutablePath) - .WithShortName(ToString()) - .WithArgs("test") - .AddNotEmptyArgs(Project) - .WithWorkingDirectory(WorkingDirectory) - .WithVars(Vars.ToArray()) - .AddTestLoggers(host, Loggers) - .AddArgs( - ("--settings", Settings), - ("--filter", Filter), - ("--test-adapter-path", $"{string.Join(";", new[] {TestAdapterPath, virtualContext.Resolve(settings.DotNetVSTestLoggerDirectory)}.Where(i => !string.IsNullOrWhiteSpace(i)))}"), - ("--configuration", Configuration), - ("--framework", Framework), - ("--runtime", Runtime), - ("--output", Output), - ("--diag", Diag), - ("--results-directory", ResultsDirectory), - ("--collect", Collect), - ("--verbosity", Verbosity?.ToString().ToLowerInvariant()), - ("--arch", Arch), - ("--os", OS), - ("--blame-crash-dump-type", BlameCrashDumpType), - ("--blame-hang-dump-type", BlameHangDumpType), - ("--blame-hang-timeout", blameHangTimeout.HasValue ? $"{(int)blameHangTimeout}milliseconds" : string.Empty) - ) - .AddBooleanArgs( - ("--list-tests", ListTests), - ("--no-build", NoBuild), - ("--blame", Blame), - ("--blame-crash", BlameCrash), - ("--blame-crash-collect-always", BlameCrashCollectAlways), - ("--blame-hang", BlameHang), - ("--nologo", NoLogo), - ("--no-restore", NoRestore) - ) - .AddProps("-p", Props.ToArray()) - .AddArgs(Args.ToArray()); - - if (string.IsNullOrWhiteSpace(Project) || Path.GetExtension(Project).ToLowerInvariant() != ".dll") - { - cmd = cmd.AddMSBuildLoggers(host, Verbosity); - } - - var runSettings = RunSettings.Select(i => $"{i.name}={i.value}").ToArray(); - if (runSettings.Any()) - { - cmd = cmd.AddArgs("--").AddArgs(runSettings); - } - - return cmd; - } - - /// - public override string ToString() => "dotnet test".GetShortName(ShortName, Project); -} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/DotNetToolRestore.cs b/CSharpInteractive.HostApi/DotNetToolRestore.cs deleted file mode 100644 index 7d5fd4c..0000000 --- a/CSharpInteractive.HostApi/DotNetToolRestore.cs +++ /dev/null @@ -1,77 +0,0 @@ -// ReSharper disable UnusedType.Global -// ReSharper disable UnusedMember.Global - -namespace HostApi; - -using Internal.DotNet; - -/// -/// The dotnet tool restore command finds the tool manifest file that is in scope for the current directory and installs the tools that are listed in it. -/// -/// -/// new DotNetToolRestore() -/// .Run().EnsureSuccess(); -/// -/// -/// -/// Specifies the set of command line arguments to use when starting the tool. -/// Specifies the set of environment variables that apply to this process and its child processes. -/// Adds an additional NuGet package source to use during installation. Feeds are accessed in parallel, not sequentially in some order of precedence. If the same package and version is in multiple feeds, the fastest feed wins. -/// Overrides the tool executable path. -/// Specifies the working directory for the tool to be started. -/// Prevent restoring multiple projects in parallel. -/// The NuGet configuration file (nuget.config) to use. If specified, only the settings from this file will be used. If not specified, the hierarchy of configuration files from the current directory will be used. -/// Path to the manifest file. -/// Do not cache packages and http requests. -/// Treat package source failures as warnings. -/// Sets the verbosity level of the command. Allowed values are Quiet, Minimal, Normal, Detailed, and Diagnostic. The default is Minimal. For more information, see LoggerVerbosity. -/// Specifies a short name for this operation. -[Target] -public partial record DotNetToolRestore( - IEnumerable Args, - IEnumerable<(string name, string value)> Vars, - IEnumerable AdditionalSources, - string ExecutablePath = "", - string WorkingDirectory = "", - bool? DisableParallel = default, - string ConfigFile = "", - string ToolManifest = "", - bool? NoCache = default, - bool? IgnoreFailedSources = default, - DotNetVerbosity? Verbosity = default, - string ShortName = "") -{ - /// - /// Create a new instance of the command. - /// - /// Specifies the set of command line arguments to use when starting the tool. - public DotNetToolRestore(params string[] args) - : this(args, [], []) - { } - - /// - public IStartInfo GetStartInfo(IHost host) - { - if (host == null) throw new ArgumentNullException(nameof(host)); - return host.CreateCommandLine(ExecutablePath) - .WithShortName(ToString()) - .WithArgs("tool", "restore") - .WithWorkingDirectory(WorkingDirectory) - .WithVars(Vars.ToArray()) - .AddMSBuildLoggers(host, Verbosity) - .AddArgs(AdditionalSources.Select(i => ("--add-source", (string?)i)).ToArray()) - .AddArgs( - ("--configfile", ConfigFile), - ("--tool-manifest", ToolManifest) - ) - .AddBooleanArgs( - ("--disable-parallel", DisableParallel), - ("--no-cache", NoCache), - ("--ignore-failed-sources", IgnoreFailedSources) - ) - .AddArgs(Args.ToArray()); - } - - /// - public override string ToString() => "dotnet tool restore".GetShortName(ShortName, ToolManifest); -} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/Internal/DotNet/DotNetCommandLineExtensions.cs b/CSharpInteractive.HostApi/Internal/DotNet/DotNetCommandLineExtensions.cs index 0728f71..eee556c 100644 --- a/CSharpInteractive.HostApi/Internal/DotNet/DotNetCommandLineExtensions.cs +++ b/CSharpInteractive.HostApi/Internal/DotNet/DotNetCommandLineExtensions.cs @@ -7,6 +7,8 @@ namespace HostApi.Internal.DotNet; using System.Diagnostics.Contracts; +using System.Globalization; +using System.Text; [ExcludeFromCodeCoverage] internal static class DotNetCommandLineExtensions @@ -31,20 +33,38 @@ private static string GetExecutablePath(this IHost host, string executablePath) } [Pure] - public static string GetShortName(this string baseName, string shortName, string path = "") + public static string GetShortName(this string baseName, string shortName, params string[] paths) { if (!string.IsNullOrWhiteSpace(shortName)) { return shortName; } - // ReSharper disable once ConvertIfStatementToReturnStatement - if (string.IsNullOrWhiteSpace(path)) + var name = new StringBuilder(); + name.Append(baseName); + foreach (var path in paths) { - return baseName; + if (string.IsNullOrWhiteSpace(path)) + { + continue; + } + + if (name.Length > 0) + { + name.Append(' '); + } + + var fileName = Path.GetFileName(path); + if (string.IsNullOrWhiteSpace(fileName)) + { + name.Append(path); + continue; + } + + name.Append(fileName); } - - return $"{baseName} {Path.GetFileName(path)}"; + + return name.ToString(); } [Pure] @@ -118,4 +138,33 @@ where arg.value ?? false public static CommandLine AddProps(this CommandLine cmd, string propertyName, params (string name, string value)[] props) => cmd.AddArgs(props.Select(i => $"{propertyName}:{i.name}={i.value}") .ToArray()); + + // ReSharper disable once UnusedParameter.Global + public static string[] ToArgs(this T value, string name, string collectionSeparator) + { + if (!string.IsNullOrWhiteSpace(collectionSeparator)) + { + return [$"{name}{collectionSeparator}\"{value}\""]; + } + + var valueStr = value?.ToString(); + return string.IsNullOrWhiteSpace(valueStr) ? [] : [name, valueStr!]; + } + + public static string[] ToArgs(this IEnumerable values, string name, string collectionSeparator) + { + if (string.IsNullOrWhiteSpace(collectionSeparator)) + { + return values.SelectMany(value => string.IsNullOrWhiteSpace(value) ? [] : new[] {name, value}).ToArray(); + } + + var str = string.Join(collectionSeparator, values); + return string.IsNullOrWhiteSpace(str) ? [] : [name, str]; + } + + // ReSharper disable once UnusedParameter.Global + public static string[] ToArgs(this TimeSpan? value, string name, string collectionSeparator) => + value.HasValue ? [name, value.Value.TotalMilliseconds.ToString(CultureInfo.InvariantCulture)] : []; + + public static string ToArg(this T value) => value?.ToString() ?? ""; } \ No newline at end of file diff --git a/CSharpInteractive.HostApi/MSBuild.cs b/CSharpInteractive.HostApi/MSBuild.cs index 4390a88..60ccc08 100644 --- a/CSharpInteractive.HostApi/MSBuild.cs +++ b/CSharpInteractive.HostApi/MSBuild.cs @@ -46,7 +46,8 @@ namespace HostApi; /// Do not auto-include any MSBuild.rsp files. /// Do not display the startup banner and copyright message. /// Display version information only. -/// Sets the verbosity level of the command. Allowed values are Quiet, Minimal, Normal, Detailed, and Diagnostic. The default is Minimal. For more information, see LoggerVerbosity. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. /// Specifies a short name for this operation. [Target] public partial record MSBuild( @@ -77,6 +78,7 @@ public partial record MSBuild( bool? NoLogo = default, bool? DisplayVersion = default, DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, string ShortName = "") { /// @@ -127,7 +129,8 @@ public IStartInfo GetStartInfo(IHost host) ("-detailedSummary", DetailedSummary), ("-noAutoResponse", NoAutoResponse), ("-noLogo", NoLogo), - ("-version", DisplayVersion) + ("-version", DisplayVersion), + ("--diagnostics", Diagnostics) ) .AddProps("-restoreProperty", RestoreProps.ToArray()) .AddProps("-p", Props.ToArray()) diff --git a/CSharpInteractive.HostApi/NuGetAuthenticationType.cs b/CSharpInteractive.HostApi/NuGetAuthenticationType.cs new file mode 100644 index 0000000..b1bf5e1 --- /dev/null +++ b/CSharpInteractive.HostApi/NuGetAuthenticationType.cs @@ -0,0 +1,43 @@ +// ReSharper disable UnusedMember.Global +namespace HostApi; + +/// +/// NuGet authentication types. +/// +public enum NuGetAuthenticationType +{ + /// + /// Basic + /// + Basic, + + /// + /// Negotiate + /// + Negotiate, + + /// + /// Kerberos + /// + Kerberos, + + /// + /// Ntlm + /// + Ntlm, + + /// + /// Digest + /// + Digest +} + +internal static class NuGetAuthenticationTypeExtensions +{ + // ReSharper disable once UnusedParameter.Global + public static string[] ToArgs(this IEnumerable authenticationTypes, string name, string collectionSeparator) + { + var authenticationTypesStr = string.Join(",", authenticationTypes.Select(i => i.ToString().ToLowerInvariant())); + return string.IsNullOrWhiteSpace(authenticationTypesStr) ? [] : [name, authenticationTypesStr]; + } +} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/NuGetCacheLocation.cs b/CSharpInteractive.HostApi/NuGetCacheLocation.cs new file mode 100644 index 0000000..b4f8eb1 --- /dev/null +++ b/CSharpInteractive.HostApi/NuGetCacheLocation.cs @@ -0,0 +1,40 @@ +namespace HostApi; + +/// +/// The cache location to list or clear. +/// +public enum NuGetCacheLocation +{ + /// + /// Indicates that the specified operation is applied to all cache types: http-request cache, global packages cache, and the temporary cache. + /// + All, + + /// + /// Indicates that the specified operation is applied only to the http-request cache. The other cache locations aren't affected. + /// + HttpCache, + + /// + /// Indicates that the specified operation is applied only to the global packages cache. The other cache locations aren't affected. + /// + GlobalPackages, + + /// + /// Indicates that the specified operation is applied only to the temporary cache. The other cache locations aren't affected. + /// + Temp +} + +internal static class NuGetCacheLocationExtensions +{ + public static string ToArg(this NuGetCacheLocation? cacheLocation) => + cacheLocation switch + { + NuGetCacheLocation.All => "all", + NuGetCacheLocation.HttpCache => "http-cache", + NuGetCacheLocation.GlobalPackages => "global-packages", + NuGetCacheLocation.Temp => "temp ", + _ => "" + }; +} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/NuGetCertificateAlgorithm.cs b/CSharpInteractive.HostApi/NuGetCertificateAlgorithm.cs new file mode 100644 index 0000000..1a04c0e --- /dev/null +++ b/CSharpInteractive.HostApi/NuGetCertificateAlgorithm.cs @@ -0,0 +1,33 @@ +// ReSharper disable UnusedMember.Global +namespace HostApi; + +/// +/// NuGet certificate algorithm. +/// +public enum NuGetCertificateAlgorithm +{ + /// + /// Sha256 + /// + Sha256, + + /// + /// Sha384 + /// + Sha384, + + /// + /// Sha512 + /// + Sha512 +} + +internal static class NuGetCertificateAlgorithmExtensions +{ + // ReSharper disable once UnusedParameter.Global + public static string[] ToArgs(this NuGetCertificateAlgorithm? algorithm, string name, string collectionSeparator) + { + var algorithmStr = algorithm?.ToString().ToUpperInvariant(); + return algorithmStr is null ? [] : [name, algorithmStr]; + } +} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/NuGetListFormat.cs b/CSharpInteractive.HostApi/NuGetListFormat.cs new file mode 100644 index 0000000..f62b3de --- /dev/null +++ b/CSharpInteractive.HostApi/NuGetListFormat.cs @@ -0,0 +1,18 @@ +// ReSharper disable UnusedMember.Global +namespace HostApi; + +/// +/// The format of the nuget list command output. +/// +public enum NuGetListFormat +{ + /// + /// Detailed. + /// + Detailed, + + /// + /// Short. + /// + Short +} \ No newline at end of file diff --git a/CSharpInteractive.HostApi/VSTest.cs b/CSharpInteractive.HostApi/VSTest.cs index 7109f6b..cd9d1c9 100644 --- a/CSharpInteractive.HostApi/VSTest.cs +++ b/CSharpInteractive.HostApi/VSTest.cs @@ -46,7 +46,8 @@ namespace HostApi; /// Specifies the port for the socket connection and receiving the event messages. /// Enables data collector for the test run. /// Runs the tests in an isolated process. This makes vstest.console.exe process less likely to be stopped on an error in the tests, but tests may run slower. -/// Sets the verbosity level of the command. Allowed values are Quiet, Minimal, Normal, Detailed, and Diagnostic. The default is Minimal. For more information, see LoggerVerbosity. +/// Sets the verbosity level of the command. Allowed values are , , , , and . The default is . For more information, see . +/// Enables diagnostic output. /// Specifies a short name for this operation. /// [Target] @@ -74,6 +75,7 @@ public partial record VSTest( string Collect = "", bool? InIsolation = default, DotNetVerbosity? Verbosity = default, + bool? Diagnostics = default, string ShortName = "") { /// @@ -117,7 +119,8 @@ public IStartInfo GetStartInfo(IHost host) ("--ListTests", ListTests), ("--Parallel", Parallel), ("--Blame", Blame), - ("--InIsolation", InIsolation) + ("--InIsolation", InIsolation), + ("--diagnostics", Diagnostics) ) .AddArgs(Args.ToArray()); diff --git a/CSharpInteractive.HostApi/VSTestPlatform.cs b/CSharpInteractive.HostApi/VSTestPlatform.cs index 2a1f1c0..ae9c01d 100644 --- a/CSharpInteractive.HostApi/VSTestPlatform.cs +++ b/CSharpInteractive.HostApi/VSTestPlatform.cs @@ -10,17 +10,17 @@ namespace HostApi; public enum VSTestPlatform { /// - /// + /// x86 /// x86, /// - /// + /// x64 /// x64, /// - /// + /// ARM /// ARM } \ No newline at end of file diff --git a/CSharpInteractive.Tests/CSharpInteractive.Tests.csproj b/CSharpInteractive.Tests/CSharpInteractive.Tests.csproj index 21157de..5b48fa2 100644 --- a/CSharpInteractive.Tests/CSharpInteractive.Tests.csproj +++ b/CSharpInteractive.Tests/CSharpInteractive.Tests.csproj @@ -16,7 +16,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/CSharpInteractive.Tests/Integration/BuildTests.cs b/CSharpInteractive.Tests/Integration/BuildTests.cs index d59272d..b70b445 100644 --- a/CSharpInteractive.Tests/Integration/BuildTests.cs +++ b/CSharpInteractive.Tests/Integration/BuildTests.cs @@ -1,7 +1,7 @@ namespace CSharpInteractive.Tests.Integration; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class BuildTests { [Fact] diff --git a/CSharpInteractive.Tests/Integration/CSharpScriptRunnerTests.cs b/CSharpInteractive.Tests/Integration/CSharpScriptRunnerTests.cs index aee2572..4b679d2 100644 --- a/CSharpInteractive.Tests/Integration/CSharpScriptRunnerTests.cs +++ b/CSharpInteractive.Tests/Integration/CSharpScriptRunnerTests.cs @@ -7,7 +7,7 @@ namespace CSharpInteractive.Tests.Integration; using Environment = Environment; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] [SuppressMessage("Usage", "xUnit1042:The member referenced by the MemberData attribute returns untyped data rows")] public class CSharpScriptRunnerTests { diff --git a/CSharpInteractive.Tests/Integration/CommandLineTests.cs b/CSharpInteractive.Tests/Integration/CommandLineTests.cs index ff25837..07edbb2 100644 --- a/CSharpInteractive.Tests/Integration/CommandLineTests.cs +++ b/CSharpInteractive.Tests/Integration/CommandLineTests.cs @@ -8,7 +8,7 @@ namespace CSharpInteractive.Tests.Integration; using Microsoft.Extensions.DependencyInjection; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class CommandLineTests { [Fact] diff --git a/CSharpInteractive.Tests/Integration/Core/DotNetScript.cs b/CSharpInteractive.Tests/Integration/Core/DotNetScript.cs index a9ed155..38e1d7f 100644 --- a/CSharpInteractive.Tests/Integration/Core/DotNetScript.cs +++ b/CSharpInteractive.Tests/Integration/Core/DotNetScript.cs @@ -7,7 +7,7 @@ namespace CSharpInteractive.Tests.Integration.Core; internal static class DotNetScript { public static CommandLine Create(IEnumerable args, params string[] lines) => - Create("script.csx", default, args, lines); + CreateForScript("script.csx", default, args, lines); public static CommandLine Create(params string[] lines) => Create([], lines); @@ -17,7 +17,7 @@ public static CommandLine Create() => Composition.Shared.Root.DotNetEnvironment.Path, Path.Combine(Path.GetDirectoryName(typeof(DotNetScript).Assembly.Location)!, "dotnet-csi.dll")); - public static CommandLine Create(string scriptName, string? workingDirectory, IEnumerable args, params string[] lines) + public static CommandLine CreateForScript(string scriptName, string? workingDirectory, IEnumerable args, params string[] lines) { workingDirectory ??= GetWorkingDirectory(); var scriptFile = Path.Combine(workingDirectory, scriptName); diff --git a/CSharpInteractive.Tests/Integration/ExitCodeTests.cs b/CSharpInteractive.Tests/Integration/ExitCodeTests.cs index efbb544..6c88b04 100644 --- a/CSharpInteractive.Tests/Integration/ExitCodeTests.cs +++ b/CSharpInteractive.Tests/Integration/ExitCodeTests.cs @@ -4,7 +4,7 @@ namespace CSharpInteractive.Tests.Integration; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class ExitCodeTests { [Fact] diff --git a/CSharpInteractive.Tests/Integration/HelpTests.cs b/CSharpInteractive.Tests/Integration/HelpTests.cs index 0c1893c..5cacdb4 100644 --- a/CSharpInteractive.Tests/Integration/HelpTests.cs +++ b/CSharpInteractive.Tests/Integration/HelpTests.cs @@ -6,7 +6,7 @@ namespace CSharpInteractive.Tests.Integration; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class HelpTests { [Theory] diff --git a/CSharpInteractive.Tests/Integration/MsDITests.cs b/CSharpInteractive.Tests/Integration/MsDITests.cs index edc13c3..1031033 100644 --- a/CSharpInteractive.Tests/Integration/MsDITests.cs +++ b/CSharpInteractive.Tests/Integration/MsDITests.cs @@ -4,7 +4,7 @@ namespace CSharpInteractive.Tests.Integration; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class MsDITests { [Fact] diff --git a/CSharpInteractive.Tests/Integration/NuGetTests.cs b/CSharpInteractive.Tests/Integration/NuGetTests.cs index 7777aa8..392fecb 100644 --- a/CSharpInteractive.Tests/Integration/NuGetTests.cs +++ b/CSharpInteractive.Tests/Integration/NuGetTests.cs @@ -8,7 +8,7 @@ namespace CSharpInteractive.Tests.Integration; using NuGet.Versioning; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class NuGetTests { [Fact] diff --git a/CSharpInteractive.Tests/Integration/ScriptRunTests.cs b/CSharpInteractive.Tests/Integration/ScriptRunTests.cs index 1cd63c0..ca5b68f 100644 --- a/CSharpInteractive.Tests/Integration/ScriptRunTests.cs +++ b/CSharpInteractive.Tests/Integration/ScriptRunTests.cs @@ -8,7 +8,7 @@ namespace CSharpInteractive.Tests.Integration; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] [SuppressMessage("Performance", "CA1861:Avoid constant arrays as arguments")] public class ScriptRunTests { @@ -242,8 +242,8 @@ public void ShouldSupportLoadWhenRelativePath() // Given var workingDirectory = DotNetScript.GetWorkingDirectory(); // ReSharper disable once UnusedVariable - var scriptAbc = DotNetScript.Create("abc.csx", workingDirectory, [], "Console.WriteLine(\"Hello\");"); - var script = DotNetScript.Create("script.csx", workingDirectory, [], "#load \"abc.csx\"").WithVars(TestTool.DefaultVars); + var scriptAbc = DotNetScript.CreateForScript("abc.csx", workingDirectory, [], "Console.WriteLine(\"Hello\");"); + var script = DotNetScript.CreateForScript("script.csx", workingDirectory, [], "#load \"abc.csx\"").WithVars(TestTool.DefaultVars); // When var result = TestTool.Run(script); @@ -261,10 +261,10 @@ public void ShouldSupportLoadMultiple() // Given var workingDirectory = DotNetScript.GetWorkingDirectory(); // ReSharper disable once UnusedVariable - var scriptClass1 = DotNetScript.Create("class1.csx", workingDirectory, [], "class Class1 { public Class1(Class2 val) {}};"); + var scriptClass1 = DotNetScript.CreateForScript("class1.csx", workingDirectory, [], "class Class1 { public Class1(Class2 val) {}};"); // ReSharper disable once UnusedVariable - var scriptClass2 = DotNetScript.Create("class2.csx", workingDirectory, [], "class Class2 {};"); - var script = DotNetScript.Create("script.csx", workingDirectory, [], "#load \"class2.csx\"", "#load \"class1.csx\"").WithVars(TestTool.DefaultVars); + var scriptClass2 = DotNetScript.CreateForScript("class2.csx", workingDirectory, [], "class Class2 {};"); + var script = DotNetScript.CreateForScript("script.csx", workingDirectory, [], "#load \"class2.csx\"", "#load \"class1.csx\"").WithVars(TestTool.DefaultVars); // When var result = TestTool.Run(script); @@ -280,10 +280,10 @@ public void ShouldSupportLoadMultiple2() // Given var workingDirectory = DotNetScript.GetWorkingDirectory(); // ReSharper disable once UnusedVariable - var scriptClass1 = DotNetScript.Create("class1.csx", workingDirectory, [], "class Class1 { public Class1(Class2 val) {}};"); + var scriptClass1 = DotNetScript.CreateForScript("class1.csx", workingDirectory, [], "class Class1 { public Class1(Class2 val) {}};"); // ReSharper disable once UnusedVariable - var scriptClass2 = DotNetScript.Create("class2.csx", workingDirectory, [], "class Class2 {};"); - var script = DotNetScript.Create("script.csx", workingDirectory, [], "// #load \"class1.csx\"", "#load \"class2.csx\"").WithVars(TestTool.DefaultVars); + var scriptClass2 = DotNetScript.CreateForScript("class2.csx", workingDirectory, [], "class Class2 {};"); + var script = DotNetScript.CreateForScript("script.csx", workingDirectory, [], "// #load \"class1.csx\"", "#load \"class2.csx\"").WithVars(TestTool.DefaultVars); // When var result = TestTool.Run(script); @@ -448,8 +448,8 @@ public void ShouldSupportCallerFilePathWhenLoad() // Given var workingDirectory = DotNetScript.GetWorkingDirectory(); // ReSharper disable once UnusedVariable - var scriptAbc = DotNetScript.Create("abc.csx", workingDirectory, [], "Console.WriteLine(GetCurrentFileName());", "string GetCurrentFileName([System.Runtime.CompilerServices.CallerFilePath] string fileName = null) => fileName;"); - var script = DotNetScript.Create("script.csx", workingDirectory, [], "#load \"abc.csx\"", "Console.WriteLine(GetCurrentFileName());").WithVars(TestTool.DefaultVars); + var scriptAbc = DotNetScript.CreateForScript("abc.csx", workingDirectory, [], "Console.WriteLine(GetCurrentFileName());", "string GetCurrentFileName([System.Runtime.CompilerServices.CallerFilePath] string fileName = null) => fileName;"); + var script = DotNetScript.CreateForScript("script.csx", workingDirectory, [], "#load \"abc.csx\"", "Console.WriteLine(GetCurrentFileName());").WithVars(TestTool.DefaultVars); // When var result = TestTool.Run(script); diff --git a/CSharpInteractive.Tests/Integration/SummaryTests.cs b/CSharpInteractive.Tests/Integration/SummaryTests.cs index 1b6455a..5bb668d 100644 --- a/CSharpInteractive.Tests/Integration/SummaryTests.cs +++ b/CSharpInteractive.Tests/Integration/SummaryTests.cs @@ -4,7 +4,7 @@ namespace CSharpInteractive.Tests.Integration; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class SummaryTests { [Fact] diff --git a/CSharpInteractive.Tests/Integration/TeamCityScriptRunTests.cs b/CSharpInteractive.Tests/Integration/TeamCityScriptRunTests.cs index a1d2c51..e1db85c 100644 --- a/CSharpInteractive.Tests/Integration/TeamCityScriptRunTests.cs +++ b/CSharpInteractive.Tests/Integration/TeamCityScriptRunTests.cs @@ -1,7 +1,7 @@ namespace CSharpInteractive.Tests.Integration; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class ScriptRunTeamCityScriptRunTests { private const int InitialMessagesCount = 3; diff --git a/CSharpInteractive.Tests/PropertiesTests.cs b/CSharpInteractive.Tests/PropertiesTests.cs index f4e7090..d0014d4 100644 --- a/CSharpInteractive.Tests/PropertiesTests.cs +++ b/CSharpInteractive.Tests/PropertiesTests.cs @@ -110,7 +110,7 @@ public void ShouldEnumeratePairs() // When // Then - props.ShouldBe([ + props.ToArray().ShouldBe([ new KeyValuePair("Abc", "Xyz"), new KeyValuePair("1", "2") ]); diff --git a/CSharpInteractive.Tests/README_TEMPLATE.md b/CSharpInteractive.Tests/README_TEMPLATE.md index e3f7278..9605185 100644 --- a/CSharpInteractive.Tests/README_TEMPLATE.md +++ b/CSharpInteractive.Tests/README_TEMPLATE.md @@ -486,15 +486,16 @@ var result = new DockerRun(cmd, "mcr.microsoft.com/dotnet/sdk") using HostApi; // Creates a new library project, running a command like: "dotnet new classlib -n MyLib --force" -new DotNetNew("xunit", "-n", "MyLib", "--force") - .Build() - .EnsureSuccess(); +new DotNetNew() + .WithTemplateName("xunit") + .WithName("MyLib") + .WithForce(true) + .Build().EnsureSuccess(); // Builds the library project, running a command like: "dotnet build" from the directory "MyLib" var result = new DotNetBuild() .WithWorkingDirectory("MyLib") - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); // The "result" variable provides details about a build result.Errors.Any(message => message.State == BuildMessageState.StdError).ShouldBeFalse(); @@ -522,25 +523,25 @@ result.Tests.Count(test => test.State == TestState.Finished).ShouldBe(1); using HostApi; // Creates a new library project, running a command like: "dotnet new classlib -n MyLib --force" -var result = new DotNetNew("classlib", "-n", "MyLib", "--force") - .Build() - .EnsureSuccess(); +var result = new DotNetNew() + .WithTemplateName("classlib") + .WithName("MyLib") + .WithForce(true) + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); // Builds the library project, running a command like: "dotnet build" from the directory "MyLib" result = new DotNetBuild() .WithWorkingDirectory("MyLib") - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); // Clean the project, running a command like: "dotnet clean" from the directory "MyLib" result = new DotNetClean() .WithWorkingDirectory("MyLib") - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); // The "result" variable provides details about a build result.ExitCode.ShouldBe(0); @@ -576,23 +577,24 @@ version.ShouldNotBeNull(); using HostApi; // Creates a new test project, running a command like: "dotnet new mstest -n MyTests --force" -var result = new DotNetNew("mstest", "-n", "MyTests", "--force") - .Build() - .EnsureSuccess(); +var result = new DotNetNew() + .WithTemplateName("mstest") + .WithName("MyTests") + .WithForce(true) + .Build().EnsureSuccess(); -result.ExitCode.ShouldBe(0); +result.ExitCode.ShouldBe(0, result.ToString()); // Runs tests via a command like: "dotnet msbuild /t:VSTest" from the directory "MyTests" result = new MSBuild() .WithTarget("VSTest") .WithWorkingDirectory("MyTests") - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); // The "result" variable provides details about a build -result.ExitCode.ShouldBe(0); -result.Summary.Tests.ShouldBe(1); -result.Tests.Count(test => test.State == TestState.Finished).ShouldBe(1); +result.ExitCode.ShouldBe(0, result.ToString()); +result.Summary.Tests.ShouldBe(1, result.ToString()); +result.Tests.Count(test => test.State == TestState.Finished).ShouldBe(1, result.ToString()); ``` @@ -606,9 +608,11 @@ result.Tests.Count(test => test.State == TestState.Finished).ShouldBe(1); using HostApi; // Creates a new library project, running a command like: "dotnet new classlib -n MyLib --force" -var result = new DotNetNew("classlib", "-n", "MyLib", "--force") - .Build() - .EnsureSuccess(); +var result = new DotNetNew() + .WithTemplateName("classlib") + .WithName("MyLib") + .WithForce(true) + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); @@ -616,8 +620,7 @@ result.ExitCode.ShouldBe(0); result = new DotNetPack() .WithWorkingDirectory("MyLib") .AddProps(("version", "1.2.3")) - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); ``` @@ -633,9 +636,12 @@ result.ExitCode.ShouldBe(0); using HostApi; // Creates a new library project, running a command like: "dotnet new classlib -n MyLib --force" -var result = new DotNetNew("classlib", "-n", "MyLib", "--force", "-f", "net8.0") - .Build() - .EnsureSuccess(); +var result = new DotNetNew() + .WithTemplateName("classlib") + .AddArgs("-f", "net8.0") + .WithName("MyLib") + .WithForce(true) + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); @@ -643,8 +649,7 @@ result.ExitCode.ShouldBe(0); result = new DotNetPublish() .WithWorkingDirectory("MyLib") .WithFramework("net8.0") - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); ``` @@ -660,17 +665,18 @@ result.ExitCode.ShouldBe(0); using HostApi; // Creates a new library project, running a command like: "dotnet new classlib -n MyLib --force" -var result = new DotNetNew("classlib", "-n", "MyLib", "--force") - .Build() - .EnsureSuccess(); +var result = new DotNetNew() + .WithTemplateName("classlib") + .WithName("MyLib") + .WithForce(true) + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); // Restore the project, running a command like: "dotnet restore" from the directory "MyLib" result = new DotNetRestore() .WithWorkingDirectory("MyLib") - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); ``` @@ -686,9 +692,11 @@ result.ExitCode.ShouldBe(0); using HostApi; // Creates a new console project, running a command like: "dotnet new console -n MyApp --force" -var result = new DotNetNew("console", "-n", "MyApp", "--force") - .Build() - .EnsureSuccess(); +var result = new DotNetNew() + .WithTemplateName("console") + .WithName("MyApp") + .WithForce(true) + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); @@ -715,9 +723,11 @@ stdOut.ShouldBe(new[] {"Hello, World!"}); using HostApi; // Creates a new test project, running a command like: "dotnet new mstest -n MyTests --force" -var result = new DotNetNew("mstest", "-n", "MyTests", "--force") - .Build() - .EnsureSuccess(); +var result = new DotNetNew() + .WithTemplateName("mstest") + .WithName("MyTests") + .WithForce(true) + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); @@ -744,20 +754,21 @@ result.Tests.Count(test => test.State == TestState.Finished).ShouldBe(1); using HostApi; // Creates a new test project, running a command like: "dotnet new mstest -n MyTests --force" -new DotNetNew("mstest", "-n", "MyTests", "--force") - .Run() - .EnsureSuccess(); +new DotNetNew() + .WithTemplateName("mstest") + .WithName("MyTests") + .WithForce(true) + .Run().EnsureSuccess(); // Creates the tool manifest and installs the dotCover tool locally // It is better to run the following 2 commands manually // and commit these changes to a source control -new DotNetNew("tool-manifest") - .Run() - .EnsureSuccess(); +new DotNetNew() + .WithTemplateName("tool-manifest") + .Run().EnsureSuccess(); new DotNetCustom("tool", "install", "--local", "JetBrains.dotCover.GlobalTool") - .Run() - .EnsureSuccess(); + .Run().EnsureSuccess(); // Creates a test command var test = new DotNetTest() @@ -778,8 +789,7 @@ var testUnderDotCover = test.Customize(cmd => // Runs tests under dotCover via a command like: "dotnet dotcover test ..." var result = testUnderDotCover - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); // The "result" variable provides details about a build result.ExitCode.ShouldBe(0); @@ -807,7 +817,8 @@ var projectDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()[..4] Directory.CreateDirectory(projectDir); // Creates a local tool manifest -new DotNetNew("tool-manifest") +new DotNetNew() + .WithTemplateName("tool-manifest") .WithWorkingDirectory(projectDir) .Run() .EnsureSuccess(); @@ -830,9 +841,11 @@ new DotNetToolRestore() using HostApi; // Creates a new test project, running a command like: "dotnet new mstest -n MyTests --force" -var result = new DotNetNew("mstest", "-n", "MyTests", "--force") - .Build() - .EnsureSuccess(); +var result = new DotNetNew() + .WithTemplateName("mstest") + .WithName("MyTests") + .WithForce(true) + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); @@ -841,8 +854,7 @@ result = new DotNetBuild() .WithWorkingDirectory("MyTests") .WithConfiguration("Release") .WithOutput("MyOutput") - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); @@ -850,8 +862,7 @@ result.ExitCode.ShouldBe(0); result = new VSTest() .AddTestFileNames(Path.Combine("MyOutput", "MyTests.dll")) .WithWorkingDirectory("MyTests") - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); // The "result" variable provides details about a build result.ExitCode.ShouldBe(0); @@ -870,9 +881,11 @@ result.Tests.Count(test => test.State == TestState.Finished).ShouldBe(1); using HostApi; // Creates a new library project, running a command like: "dotnet new classlib -n MyLib --force" -var result = new DotNetNew("classlib", "-n", "MyLib", "--force") - .Build() - .EnsureSuccess(); +var result = new DotNetNew() + .WithTemplateName("classlib") + .WithName("MyLib") + .WithForce(true) + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); @@ -883,8 +896,7 @@ result = new MSBuild() .WithRestore(true) .AddProps(("configuration", "Release")) .WithVerbosity(DotNetVerbosity.Detailed) - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); // The "result" variable provides details about a build result.Errors.Any(message => message.State == BuildMessageState.StdError).ShouldBeFalse(); diff --git a/CSharpInteractive.Tests/README_TEMPLATE.tt b/CSharpInteractive.Tests/README_TEMPLATE.tt index 119cfac..4ad63b1 100644 --- a/CSharpInteractive.Tests/README_TEMPLATE.tt +++ b/CSharpInteractive.Tests/README_TEMPLATE.tt @@ -48,7 +48,7 @@ { var parts = str.Substring(4, str.Length - 4).Split([ '=' - ], 2, StringSplitOptions.RemoveEmptyEntries); + ], 2, StringSplitOptions.RemoveEmptyEntries); if (parts.Length == 2) { var key = parts[0]; diff --git a/CSharpInteractive.Tests/UsageScenarios/CommandLineAsyncCancellation.cs b/CSharpInteractive.Tests/UsageScenarios/CommandLineAsyncCancellation.cs index 2451950..702fcb8 100644 --- a/CSharpInteractive.Tests/UsageScenarios/CommandLineAsyncCancellation.cs +++ b/CSharpInteractive.Tests/UsageScenarios/CommandLineAsyncCancellation.cs @@ -7,7 +7,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class CommandLineAsyncCancellation : BaseScenario { [SkippableFact] diff --git a/CSharpInteractive.Tests/UsageScenarios/CommandLineAsyncScenario.cs b/CSharpInteractive.Tests/UsageScenarios/CommandLineAsyncScenario.cs index e583952..377b2a0 100644 --- a/CSharpInteractive.Tests/UsageScenarios/CommandLineAsyncScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/CommandLineAsyncScenario.cs @@ -8,7 +8,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class CommandLineAsyncScenario : BaseScenario { [SkippableFact] diff --git a/CSharpInteractive.Tests/UsageScenarios/CommandLineInParallelScenario.cs b/CSharpInteractive.Tests/UsageScenarios/CommandLineInParallelScenario.cs index fba2c61..04f3abc 100644 --- a/CSharpInteractive.Tests/UsageScenarios/CommandLineInParallelScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/CommandLineInParallelScenario.cs @@ -8,7 +8,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class CommandLineInParallelScenario : BaseScenario { [SkippableFact] diff --git a/CSharpInteractive.Tests/UsageScenarios/CommandLineOutputScenario.cs b/CSharpInteractive.Tests/UsageScenarios/CommandLineOutputScenario.cs index 3206776..3dd3cf6 100644 --- a/CSharpInteractive.Tests/UsageScenarios/CommandLineOutputScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/CommandLineOutputScenario.cs @@ -7,7 +7,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class CommandLineOutputScenario : BaseScenario { [SkippableFact] diff --git a/CSharpInteractive.Tests/UsageScenarios/CommandLineScenario.cs b/CSharpInteractive.Tests/UsageScenarios/CommandLineScenario.cs index 469adcc..cbd9af3 100644 --- a/CSharpInteractive.Tests/UsageScenarios/CommandLineScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/CommandLineScenario.cs @@ -7,7 +7,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class CommandLineScenario : BaseScenario { [SkippableFact] diff --git a/CSharpInteractive.Tests/UsageScenarios/CommandLineWithTimeoutScenario.cs b/CSharpInteractive.Tests/UsageScenarios/CommandLineWithTimeoutScenario.cs index bdb6d4e..7608f25 100644 --- a/CSharpInteractive.Tests/UsageScenarios/CommandLineWithTimeoutScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/CommandLineWithTimeoutScenario.cs @@ -7,7 +7,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class CommandLineWithTimeoutScenario : BaseScenario { [SkippableFact] diff --git a/CSharpInteractive.Tests/UsageScenarios/CommandLinesScenario.cs b/CSharpInteractive.Tests/UsageScenarios/CommandLinesScenario.cs index c973c86..d40027d 100644 --- a/CSharpInteractive.Tests/UsageScenarios/CommandLinesScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/CommandLinesScenario.cs @@ -10,7 +10,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class CommandLinesScenario : BaseScenario { [SkippableFact] diff --git a/CSharpInteractive.Tests/UsageScenarios/DockerDotNetBuildScenario.cs b/CSharpInteractive.Tests/UsageScenarios/DockerDotNetBuildScenario.cs index 10162bc..5534537 100644 --- a/CSharpInteractive.Tests/UsageScenarios/DockerDotNetBuildScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/DockerDotNetBuildScenario.cs @@ -10,8 +10,8 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] -[Trait("Docker", "true")] +[Trait("Integration", "True")] +[Trait("Docker", "True")] public class DockerDotNetBuildScenario : BaseScenario { //[Fact(Skip = "Linux Docker only")] diff --git a/CSharpInteractive.Tests/UsageScenarios/DockerRunScenario.cs b/CSharpInteractive.Tests/UsageScenarios/DockerRunScenario.cs index 8532aee..94a41ad 100644 --- a/CSharpInteractive.Tests/UsageScenarios/DockerRunScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/DockerRunScenario.cs @@ -7,8 +7,8 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] -[Trait("Docker", "true")] +[Trait("Integration", "True")] +[Trait("Docker", "True")] public class DockerRunScenario : BaseScenario { [Fact] @@ -32,6 +32,6 @@ public void Run() .EnsureSuccess(); // } - result.ExitCode.ShouldBe(0); + result.ExitCode.ShouldBe(0, result.ToString()); } } \ No newline at end of file diff --git a/CSharpInteractive.Tests/UsageScenarios/DotNetBuildScenario.cs b/CSharpInteractive.Tests/UsageScenarios/DotNetBuildScenario.cs index 78b372f..c2f53d8 100644 --- a/CSharpInteractive.Tests/UsageScenarios/DotNetBuildScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/DotNetBuildScenario.cs @@ -8,7 +8,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class DotNetBuildScenario : BaseScenario { [Fact] @@ -23,15 +23,16 @@ public void Run() // ## using HostApi; // Creates a new library project, running a command like: "dotnet new classlib -n MyLib --force" - new DotNetNew("xunit", "-n", "MyLib", "--force") - .Build() - .EnsureSuccess(); + new DotNetNew() + .WithTemplateName("xunit") + .WithName("MyLib") + .WithForce(true) + .Build().EnsureSuccess(); // Builds the library project, running a command like: "dotnet build" from the directory "MyLib" var result = new DotNetBuild() .WithWorkingDirectory("MyLib") - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); // The "result" variable provides details about a build result.Errors.Any(message => message.State == BuildMessageState.StdError).ShouldBeFalse(); diff --git a/CSharpInteractive.Tests/UsageScenarios/DotNetBuildServerShutdownScenario.cs b/CSharpInteractive.Tests/UsageScenarios/DotNetBuildServerShutdownScenario.cs index f2c282b..1926748 100644 --- a/CSharpInteractive.Tests/UsageScenarios/DotNetBuildServerShutdownScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/DotNetBuildServerShutdownScenario.cs @@ -7,7 +7,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class DotNetBuildServerShutdownScenario : BaseScenario { [Fact] diff --git a/CSharpInteractive.Tests/UsageScenarios/DotNetCleanScenario.cs b/CSharpInteractive.Tests/UsageScenarios/DotNetCleanScenario.cs index 222bc9b..f611706 100644 --- a/CSharpInteractive.Tests/UsageScenarios/DotNetCleanScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/DotNetCleanScenario.cs @@ -8,7 +8,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class DotNetCleanScenario : BaseScenario { [Fact] @@ -23,25 +23,25 @@ public void Run() // ## using HostApi; // Creates a new library project, running a command like: "dotnet new classlib -n MyLib --force" - var result = new DotNetNew("classlib", "-n", "MyLib", "--force") - .Build() - .EnsureSuccess(); + var result = new DotNetNew() + .WithTemplateName("classlib") + .WithName("MyLib") + .WithForce(true) + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); // Builds the library project, running a command like: "dotnet build" from the directory "MyLib" result = new DotNetBuild() .WithWorkingDirectory("MyLib") - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); // Clean the project, running a command like: "dotnet clean" from the directory "MyLib" result = new DotNetClean() .WithWorkingDirectory("MyLib") - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); // The "result" variable provides details about a build result.ExitCode.ShouldBe(0); diff --git a/CSharpInteractive.Tests/UsageScenarios/DotNetCustomScenario.cs b/CSharpInteractive.Tests/UsageScenarios/DotNetCustomScenario.cs index c4c59ad..f89e520 100644 --- a/CSharpInteractive.Tests/UsageScenarios/DotNetCustomScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/DotNetCustomScenario.cs @@ -9,7 +9,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using NuGet.Versioning; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] [SuppressMessage("Performance", "CA1806:Do not ignore method results")] public class DotNetCustomScenario : BaseScenario { diff --git a/CSharpInteractive.Tests/UsageScenarios/DotNetMSBuildVSTestScenario.cs b/CSharpInteractive.Tests/UsageScenarios/DotNetMSBuildVSTestScenario.cs index bf536af..15fd337 100644 --- a/CSharpInteractive.Tests/UsageScenarios/DotNetMSBuildVSTestScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/DotNetMSBuildVSTestScenario.cs @@ -8,7 +8,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class DotNetMSBuildVSTestScenario : BaseScenario { [Fact] @@ -23,23 +23,24 @@ public void Run() // ## using HostApi; // Creates a new test project, running a command like: "dotnet new mstest -n MyTests --force" - var result = new DotNetNew("mstest", "-n", "MyTests", "--force") - .Build() - .EnsureSuccess(); + var result = new DotNetNew() + .WithTemplateName("mstest") + .WithName("MyTests") + .WithForce(true) + .Build().EnsureSuccess(); - result.ExitCode.ShouldBe(0); + result.ExitCode.ShouldBe(0, result.ToString()); // Runs tests via a command like: "dotnet msbuild /t:VSTest" from the directory "MyTests" result = new MSBuild() .WithTarget("VSTest") .WithWorkingDirectory("MyTests") - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); // The "result" variable provides details about a build - result.ExitCode.ShouldBe(0); - result.Summary.Tests.ShouldBe(1); - result.Tests.Count(test => test.State == TestState.Finished).ShouldBe(1); + result.ExitCode.ShouldBe(0, result.ToString()); + result.Summary.Tests.ShouldBe(1, result.ToString()); + result.Tests.Count(test => test.State == TestState.Finished).ShouldBe(1, result.ToString()); // } } } \ No newline at end of file diff --git a/CSharpInteractive.Tests/UsageScenarios/DotNetPackScenario.cs b/CSharpInteractive.Tests/UsageScenarios/DotNetPackScenario.cs index 23acc7e..92b4ebb 100644 --- a/CSharpInteractive.Tests/UsageScenarios/DotNetPackScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/DotNetPackScenario.cs @@ -8,7 +8,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class DotNetPackScenario : BaseScenario { [Fact] @@ -23,9 +23,11 @@ public void Run() // ## using HostApi; // Creates a new library project, running a command like: "dotnet new classlib -n MyLib --force" - var result = new DotNetNew("classlib", "-n", "MyLib", "--force") - .Build() - .EnsureSuccess(); + var result = new DotNetNew() + .WithTemplateName("classlib") + .WithName("MyLib") + .WithForce(true) + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); @@ -33,8 +35,7 @@ public void Run() result = new DotNetPack() .WithWorkingDirectory("MyLib") .AddProps(("version", "1.2.3")) - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); // } diff --git a/CSharpInteractive.Tests/UsageScenarios/DotNetPublishScenario.cs b/CSharpInteractive.Tests/UsageScenarios/DotNetPublishScenario.cs index 0ed7a15..e9fc34c 100644 --- a/CSharpInteractive.Tests/UsageScenarios/DotNetPublishScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/DotNetPublishScenario.cs @@ -8,7 +8,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class DotNetPublishScenario : BaseScenario { [Fact] @@ -23,9 +23,12 @@ public void Run() // ## using HostApi; // Creates a new library project, running a command like: "dotnet new classlib -n MyLib --force" - var result = new DotNetNew("classlib", "-n", "MyLib", "--force", "-f", "net8.0") - .Build() - .EnsureSuccess(); + var result = new DotNetNew() + .WithTemplateName("classlib") + .AddArgs("-f", "net8.0") + .WithName("MyLib") + .WithForce(true) + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); @@ -33,8 +36,7 @@ public void Run() result = new DotNetPublish() .WithWorkingDirectory("MyLib") .WithFramework("net8.0") - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); // } diff --git a/CSharpInteractive.Tests/UsageScenarios/DotNetRestoreScenario.cs b/CSharpInteractive.Tests/UsageScenarios/DotNetRestoreScenario.cs index 23814db..92699e3 100644 --- a/CSharpInteractive.Tests/UsageScenarios/DotNetRestoreScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/DotNetRestoreScenario.cs @@ -8,7 +8,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class DotNetRestoreScenario : BaseScenario { [Fact] @@ -23,17 +23,18 @@ public void Run() // ## using HostApi; // Creates a new library project, running a command like: "dotnet new classlib -n MyLib --force" - var result = new DotNetNew("classlib", "-n", "MyLib", "--force") - .Build() - .EnsureSuccess(); + var result = new DotNetNew() + .WithTemplateName("classlib") + .WithName("MyLib") + .WithForce(true) + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); // Restore the project, running a command like: "dotnet restore" from the directory "MyLib" result = new DotNetRestore() .WithWorkingDirectory("MyLib") - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); // } diff --git a/CSharpInteractive.Tests/UsageScenarios/DotNetRunScenario.cs b/CSharpInteractive.Tests/UsageScenarios/DotNetRunScenario.cs index 5e3a1a4..dae0388 100644 --- a/CSharpInteractive.Tests/UsageScenarios/DotNetRunScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/DotNetRunScenario.cs @@ -8,7 +8,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] [SuppressMessage("Performance", "CA1861:Avoid constant arrays as arguments")] public class DotNetRunScenario : BaseScenario { @@ -24,9 +24,11 @@ public void Run() // ## using HostApi; // Creates a new console project, running a command like: "dotnet new console -n MyApp --force" - var result = new DotNetNew("console", "-n", "MyApp", "--force") - .Build() - .EnsureSuccess(); + var result = new DotNetNew() + .WithTemplateName("console") + .WithName("MyApp") + .WithForce(true) + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); diff --git a/CSharpInteractive.Tests/UsageScenarios/DotNetTestScenario.cs b/CSharpInteractive.Tests/UsageScenarios/DotNetTestScenario.cs index 762f58d..16d5b28 100644 --- a/CSharpInteractive.Tests/UsageScenarios/DotNetTestScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/DotNetTestScenario.cs @@ -7,7 +7,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class DotNetTestScenario : BaseScenario { [Fact] @@ -22,9 +22,11 @@ public void Run() // ## using HostApi; // Creates a new test project, running a command like: "dotnet new mstest -n MyTests --force" - var result = new DotNetNew("mstest", "-n", "MyTests", "--force") - .Build() - .EnsureSuccess(); + var result = new DotNetNew() + .WithTemplateName("mstest") + .WithName("MyTests") + .WithForce(true) + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); @@ -45,7 +47,11 @@ public void Run() public void RunAsCommandLine() { // Creates a new test project, running a command like: "dotnet new mstest -n MyTests --force" - var result = new DotNetNew("mstest", "-n", "MyTests", "--force").Build(); + var result = new DotNetNew() + .WithTemplateName("mstest") + .WithName("MyTests") + .WithForce(true) + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); // Runs tests via a command like: "dotnet test" from the directory "MyTests" diff --git a/CSharpInteractive.Tests/UsageScenarios/DotNetTestWithDotCoverScenario.cs b/CSharpInteractive.Tests/UsageScenarios/DotNetTestWithDotCoverScenario.cs index bdd19d5..4fe0a4d 100644 --- a/CSharpInteractive.Tests/UsageScenarios/DotNetTestWithDotCoverScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/DotNetTestWithDotCoverScenario.cs @@ -7,7 +7,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class DotNetTestWithDotCoverScenario : BaseScenario { [Fact] @@ -22,20 +22,21 @@ public void Run() // ## using HostApi; // Creates a new test project, running a command like: "dotnet new mstest -n MyTests --force" - new DotNetNew("mstest", "-n", "MyTests", "--force") - .Run() - .EnsureSuccess(); + new DotNetNew() + .WithTemplateName("mstest") + .WithName("MyTests") + .WithForce(true) + .Run().EnsureSuccess(); // Creates the tool manifest and installs the dotCover tool locally // It is better to run the following 2 commands manually // and commit these changes to a source control - new DotNetNew("tool-manifest") - .Run() - .EnsureSuccess(); + new DotNetNew() + .WithTemplateName("tool-manifest") + .Run().EnsureSuccess(); new DotNetCustom("tool", "install", "--local", "JetBrains.dotCover.GlobalTool") - .Run() - .EnsureSuccess(); + .Run().EnsureSuccess(); // Creates a test command var test = new DotNetTest() @@ -56,8 +57,7 @@ public void Run() // Runs tests under dotCover via a command like: "dotnet dotcover test ..." var result = testUnderDotCover - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); // The "result" variable provides details about a build result.ExitCode.ShouldBe(0); diff --git a/CSharpInteractive.Tests/UsageScenarios/DotNetToolRestoreScenario.cs b/CSharpInteractive.Tests/UsageScenarios/DotNetToolRestoreScenario.cs index 54870bb..80bfb8e 100644 --- a/CSharpInteractive.Tests/UsageScenarios/DotNetToolRestoreScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/DotNetToolRestoreScenario.cs @@ -8,7 +8,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class DotNetToolRestoreScenario : BaseScenario { [Fact] @@ -26,7 +26,8 @@ public void Run() Directory.CreateDirectory(projectDir); // Creates a local tool manifest - new DotNetNew("tool-manifest") + new DotNetNew() + .WithTemplateName("tool-manifest") .WithWorkingDirectory(projectDir) .Run() .EnsureSuccess(); diff --git a/CSharpInteractive.Tests/UsageScenarios/DotNetVSTestScenario.cs b/CSharpInteractive.Tests/UsageScenarios/DotNetVSTestScenario.cs index 1ec2c8d..bfa3da0 100644 --- a/CSharpInteractive.Tests/UsageScenarios/DotNetVSTestScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/DotNetVSTestScenario.cs @@ -8,7 +8,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class DotNetVSTestScenario : BaseScenario { [Fact] @@ -23,9 +23,11 @@ public void Run() // ## using HostApi; // Creates a new test project, running a command like: "dotnet new mstest -n MyTests --force" - var result = new DotNetNew("mstest", "-n", "MyTests", "--force") - .Build() - .EnsureSuccess(); + var result = new DotNetNew() + .WithTemplateName("mstest") + .WithName("MyTests") + .WithForce(true) + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); @@ -34,8 +36,7 @@ public void Run() .WithWorkingDirectory("MyTests") .WithConfiguration("Release") .WithOutput("MyOutput") - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); @@ -43,8 +44,7 @@ public void Run() result = new VSTest() .AddTestFileNames(Path.Combine("MyOutput", "MyTests.dll")) .WithWorkingDirectory("MyTests") - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); // The "result" variable provides details about a build result.ExitCode.ShouldBe(0); @@ -57,9 +57,11 @@ public void Run() public void RunAsCommandLine() { // Creates a new test project, running a command like: "dotnet new mstest -n MyTests --force" - var result = new DotNetNew("mstest", "-n", "MyTests", "--force") - .Build() - .EnsureSuccess(); + var result = new DotNetNew() + .WithTemplateName("mstest") + .WithName("MyTests") + .WithForce(true) + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); @@ -68,8 +70,7 @@ public void RunAsCommandLine() .WithWorkingDirectory("MyTests") .WithConfiguration("Release") .WithOutput("MyOutput") - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); diff --git a/CSharpInteractive.Tests/UsageScenarios/MSBuildScenario.cs b/CSharpInteractive.Tests/UsageScenarios/MSBuildScenario.cs index da4c804..9ab3f9f 100644 --- a/CSharpInteractive.Tests/UsageScenarios/MSBuildScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/MSBuildScenario.cs @@ -9,7 +9,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using HostApi; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class MSBuildScenario : BaseScenario { [Fact] @@ -24,9 +24,11 @@ public void Run() // ## using HostApi; // Creates a new library project, running a command like: "dotnet new classlib -n MyLib --force" - var result = new DotNetNew("classlib", "-n", "MyLib", "--force") - .Build() - .EnsureSuccess(); + var result = new DotNetNew() + .WithTemplateName("classlib") + .WithName("MyLib") + .WithForce(true) + .Build().EnsureSuccess(); result.ExitCode.ShouldBe(0); @@ -37,8 +39,7 @@ public void Run() .WithRestore(true) .AddProps(("configuration", "Release")) .WithVerbosity(DotNetVerbosity.Detailed) - .Build() - .EnsureSuccess(); + .Build().EnsureSuccess(); // The "result" variable provides details about a build result.Errors.Any(message => message.State == BuildMessageState.StdError).ShouldBeFalse(); diff --git a/CSharpInteractive.Tests/UsageScenarios/NuGetRestoreAdvanced.cs b/CSharpInteractive.Tests/UsageScenarios/NuGetRestoreAdvanced.cs index 807fdf5..c6c1b65 100644 --- a/CSharpInteractive.Tests/UsageScenarios/NuGetRestoreAdvanced.cs +++ b/CSharpInteractive.Tests/UsageScenarios/NuGetRestoreAdvanced.cs @@ -7,7 +7,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using NuGet.Versioning; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class NuGetRestoreAdvanced : BaseScenario { [SkippableFact] diff --git a/CSharpInteractive.Tests/UsageScenarios/NuGetRestoreScenario.cs b/CSharpInteractive.Tests/UsageScenarios/NuGetRestoreScenario.cs index 2a39699..49d4ebb 100644 --- a/CSharpInteractive.Tests/UsageScenarios/NuGetRestoreScenario.cs +++ b/CSharpInteractive.Tests/UsageScenarios/NuGetRestoreScenario.cs @@ -7,7 +7,7 @@ namespace CSharpInteractive.Tests.UsageScenarios; using NuGet.Versioning; [CollectionDefinition("Integration", DisableParallelization = true)] -[Trait("Integration", "true")] +[Trait("Integration", "True")] public class NuGetRestoreScenario : BaseScenario { [SkippableFact] diff --git a/CSharpInteractive.sln.DotSettings b/CSharpInteractive.sln.DotSettings index 4693855..9e12257 100644 --- a/CSharpInteractive.sln.DotSettings +++ b/CSharpInteractive.sln.DotSettings @@ -294,6 +294,8 @@ } } C:\Users\Nikolay.Pianikov\AppData\Local\JetBrains\Shared\vAny\Sessions + True + True True True True @@ -302,7 +304,9 @@ True True True + True True + True True True True @@ -317,14 +321,18 @@ True True True + True True True True True True + True + True True True True + True True True True \ No newline at end of file diff --git a/CSharpInteractive/CSharpInteractive.Tool.csproj b/CSharpInteractive/CSharpInteractive.Tool.csproj index 8e9d661..a2ff4a5 100644 --- a/CSharpInteractive/CSharpInteractive.Tool.csproj +++ b/CSharpInteractive/CSharpInteractive.Tool.csproj @@ -48,15 +48,15 @@ - + - + - + diff --git a/CSharpInteractive/CSharpInteractive.csproj b/CSharpInteractive/CSharpInteractive.csproj index baff6e5..1be78c5 100644 --- a/CSharpInteractive/CSharpInteractive.csproj +++ b/CSharpInteractive/CSharpInteractive.csproj @@ -42,15 +42,15 @@ - + - + - + diff --git a/Samples/MySampleLib/MySampleLib.Tests/MySampleLib.Tests.csproj b/Samples/MySampleLib/MySampleLib.Tests/MySampleLib.Tests.csproj index 228189c..efd3aca 100644 --- a/Samples/MySampleLib/MySampleLib.Tests/MySampleLib.Tests.csproj +++ b/Samples/MySampleLib/MySampleLib.Tests/MySampleLib.Tests.csproj @@ -7,7 +7,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all