5 instantiations of CommandLineSwitches
MSBuild (5)
CommandLine\CommandLineParser.cs (4)
76
CommandLineSwitches result =
new
();
112
switchesNotFromAutoResponseFile = new
CommandLineSwitches
();
117
switchesFromAutoResponseFile = new
CommandLineSwitches
();
124
CommandLineSwitches switchesFromEnvironmentVariable =
new
();
XMake.cs (1)
3039
CommandLineSwitches commandLineSwitches = new
CommandLineSwitches
();
148 references to CommandLineSwitches
MSBuild (148)
CommandLine\CommandLineParser.cs (27)
17
using static Microsoft.Build.CommandLine.Experimental.
CommandLineSwitches
;
71
out
CommandLineSwitches
responseFileSwitches,
72
out
CommandLineSwitches
commandLineSwitches,
76
CommandLineSwitches
result = new();
98
out
CommandLineSwitches
switchesFromAutoResponseFile,
99
out
CommandLineSwitches
switchesNotFromAutoResponseFile,
124
CommandLineSwitches
switchesFromEnvironmentVariable = new();
134
ref
CommandLineSwitches
switches,
229
internal void GatherCommandLineSwitches(IEnumerable<string> commandLineArgs,
CommandLineSwitches
commandLineSwitches, string commandLine = "")
309
if (
CommandLineSwitches
.IsParameterlessSwitch(switchName, out var parameterlessSwitch, out var duplicateSwitchErrorMessage))
313
else if (
CommandLineSwitches
.IsParameterizedSwitch(switchName, out var parameterizedSwitch, out duplicateSwitchErrorMessage, out var multipleParametersAllowed, out var missingParametersErrorMessage, out var unquoteParameters, out var allowEmptyParameters))
332
private void GatherResponseFileSwitch(string unquotedCommandLineArg,
CommandLineSwitches
commandLineSwitches, string commandLine)
397
CommandLineSwitches
.SwitchesFromResponseFiles.Add((responseFile, string.Join(" ", argsFromResponseFile)));
430
CommandLineSwitches
commandLineSwitches,
431
CommandLineSwitches
.ParameterlessSwitch parameterlessSwitch,
470
CommandLineSwitches
commandLineSwitches,
471
CommandLineSwitches
.ParameterizedSwitch parameterizedSwitch,
492
if (parameterizedSwitch ==
CommandLineSwitches
.ParameterizedSwitch.Project && IsEnvironmentVariable(switchParameters))
526
internal bool CheckAndGatherProjectAutoResponseFile(
CommandLineSwitches
switchesFromAutoResponseFile,
CommandLineSwitches
commandLineSwitches, bool recursing, string commandLine)
530
var projectDirectory = GetProjectDirectory(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Project]);
532
if (!recursing && !commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.NoAutoResponse])
660
private bool GatherAutoResponseFileSwitches(string path,
CommandLineSwitches
switchesFromAutoResponseFile, string commandLine)
666
private bool GatherAutoResponseFileSwitchesFromFullPath(string autoResponseFile,
CommandLineSwitches
switchesFromAutoResponseFile, string commandLine)
677
if (switchesFromAutoResponseFile[
CommandLineSwitches
.ParameterlessSwitch.NoAutoResponse])
680
switchesFromAutoResponseFile.GetParameterlessSwitchCommandLineArg(
CommandLineSwitches
.ParameterlessSwitch.NoAutoResponse), commandLine);
733
CommandLineSwitches
.SwitchesFromResponseFiles = new();
CommandLine\CommandLineSwitches.cs (1)
914
internal void Append(
CommandLineSwitches
switchesToAppend, string commandLine = "")
CommandLine\CommandLineSwitchesAccessor.cs (3)
4
using static Microsoft.Build.CommandLine.Experimental.
CommandLineSwitches
;
10
private readonly
CommandLineSwitches
switches;
12
internal CommandLineSwitchesAccessor(
CommandLineSwitches
switches)
XMake.cs (117)
323
out
CommandLineSwitches
switchesFromAutoResponseFile,
324
out
CommandLineSwitches
switchesNotFromAutoResponseFile,
405
out
CommandLineSwitches
switchesFromAutoResponseFile,
406
out
CommandLineSwitches
switchesNotFromAutoResponseFile,
426
CommandLineSwitches
commandLineSwitches = CombineSwitchesRespectingPriority(switchesFromAutoResponseFile, switchesNotFromAutoResponseFile, fullCommandLine);
442
commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Project],
443
commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.IgnoreProjectExtensions],
450
bool nodeReuse = ProcessNodeReuseSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeReuse]);
456
commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.Help] ||
457
commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.NodeMode) ||
458
commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.Version] ||
854
CommandLineSwitches
preGatheredSwitchesFromAutoResponseFile,
855
CommandLineSwitches
preGatheredSwitchesNotFromAutoResponseFile)
949
CommandLineSwitches
switchesFromAutoResponseFile;
950
CommandLineSwitches
switchesNotFromAutoResponseFile;
1014
CommandLineSwitches
.SwitchesFromResponseFiles = null;
1023
&& switchesNotFromAutoResponseFile[
CommandLineSwitches
.ParameterizedSwitch.MaxCPUCount].Length == 0
1024
&& switchesFromAutoResponseFile[
CommandLineSwitches
.ParameterizedSwitch.MaxCPUCount].Length == 0
1757
Console.WriteLine(ResourceUtilities.GetResourceString("UnsupportedSwitchForSolutionFiles"),
CommandLineSwitches
.ParameterizedSwitch.Preprocess);
1778
Console.WriteLine(ResourceUtilities.GetResourceString("UnsupportedSwitchForSolutionFiles"),
CommandLineSwitches
.ParameterizedSwitch.Targets);
2419
CommandLineSwitches
switchesFromAutoResponseFile,
2420
CommandLineSwitches
switchesNotFromAutoResponseFile,
2468
CommandLineSwitches
commandLineSwitches = CombineSwitchesRespectingPriority(switchesFromAutoResponseFile, switchesNotFromAutoResponseFile, commandLine);
2490
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.NoLogo))
2492
noLogo = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NoLogo], defaultValue: true, resourceName: "InvalidNoLogoValue");
2505
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.LowPriority))
2507
lowPriority = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.LowPriority], defaultValue: true, resourceName: "InvalidLowPriorityValue");
2534
if (commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.Help])
2538
else if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.NodeMode))
2555
if (commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.Version])
2560
else if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.FeatureAvailability))
2562
ShowFeatureAvailability(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.FeatureAvailability]);
2627
commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Project],
2628
commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.IgnoreProjectExtensions],
2632
targets = ProcessTargetSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Target]);
2635
getProperty = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GetProperty] ?? [];
2636
getItem = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GetItem] ?? [];
2637
getTargetResult = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GetTargetResult] ?? [];
2638
getResultOutputFile = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GetResultOutputFile].FirstOrDefault() ?? string.Empty;
2643
commandLineSwitches.SetParameterizedSwitch(
CommandLineSwitches
.ParameterizedSwitch.Verbosity, "q", "q", true, true, true);
2649
toolsVersion = ProcessToolsVersionSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ToolsVersion]);
2652
globalProperties = ProcessPropertySwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Property]);
2655
restoreProperties = ProcessPropertySwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.RestoreProperty]);
2658
cpuCount = ProcessMaxCPUCountSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.MaxCPUCount]);
2664
enableNodeReuse = ProcessNodeReuseSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeReuse]);
2668
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Preprocess))
2670
preprocessWriter = ProcessPreprocessSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Preprocess]);
2675
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Targets))
2677
targetsWriter = ProcessTargetsSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Targets]);
2686
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Restore))
2688
enableRestore = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Restore], defaultValue: true, resourceName: "InvalidRestoreValue");
2691
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Interactive))
2693
interactive = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Interactive], defaultValue: true, resourceName: "InvalidInteractiveValue");
2696
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.IsolateProjects))
2698
isolateProjects = ProcessIsolateProjectsSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.IsolateProjects]);
2701
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.GraphBuild))
2703
graphBuild = ProcessGraphBuildSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GraphBuild]);
2706
question = commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Question);
2752
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.WarningsNotAsErrors) &&
2756
commandLineSwitches.GetParameterizedSwitchCommandLineArg(
CommandLineSwitches
.ParameterizedSwitch.WarningsNotAsErrors),
2768
private static bool IsBuildCheckEnabled(
CommandLineSwitches
commandLineSwitches)
2771
bool isBuildCheckEnabled = commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Check);
2775
internal static bool IsMultiThreadedEnabled(
CommandLineSwitches
commandLineSwitches)
2783
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.MultiThreaded))
2786
commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.MultiThreaded],
2794
private static bool ProcessTerminalLoggerConfiguration(
CommandLineSwitches
commandLineSwitches, out string aggregatedParameters)
2888
bool TryFromCommandLine(
CommandLineSwitches
commandLineSwitches1)
2890
if (!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.TerminalLogger))
2896
string[] switches = commandLineSwitches1[
CommandLineSwitches
.ParameterizedSwitch.TerminalLogger];
2962
string AggregateParameters(
CommandLineSwitches
switches)
2964
string[] terminalLoggerParameters = switches[
CommandLineSwitches
.ParameterizedSwitch.TerminalLoggerParameters];
3032
internal static
CommandLineSwitches
CombineSwitchesRespectingPriority(
CommandLineSwitches
switchesFromAutoResponseFile,
CommandLineSwitches
switchesNotFromAutoResponseFile, string commandLine)
3039
CommandLineSwitches
commandLineSwitches = new CommandLineSwitches();
3045
private static bool WarningsAsErrorsSwitchIsEmpty(
CommandLineSwitches
commandLineSwitches)
3047
string val = commandLineSwitches.GetParameterizedSwitchCommandLineArg(
CommandLineSwitches
.ParameterizedSwitch.WarningsAsErrors);
3121
private static string ProcessOutputResultsCache(
CommandLineSwitches
commandLineSwitches)
3123
return commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.OutputResultsCache)
3124
? commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.OutputResultsCache].FirstOrDefault(p => p != null) ?? string.Empty
3128
private static string[] ProcessInputResultsCaches(
CommandLineSwitches
commandLineSwitches)
3130
return commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.InputResultsCaches)
3131
? commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.InputResultsCaches].Where(p => p != null).ToArray()
3254
private static ISet<string> ProcessWarningRelatedSwitch(
CommandLineSwitches
commandLineSwitches,
CommandLineSwitches
.ParameterizedSwitch warningSwitch)
3283
internal static ISet<string> ProcessWarnAsErrorSwitch(
CommandLineSwitches
commandLineSwitches)
3285
return ProcessWarningRelatedSwitch(commandLineSwitches,
CommandLineSwitches
.ParameterizedSwitch.WarningsAsErrors);
3288
internal static ISet<string> ProcessWarnAsMessageSwitch(
CommandLineSwitches
commandLineSwitches)
3290
return ProcessWarningRelatedSwitch(commandLineSwitches,
CommandLineSwitches
.ParameterizedSwitch.WarningsAsMessages);
3293
internal static ISet<string> ProcessWarnNotAsErrorSwitch(
CommandLineSwitches
commandLineSwitches)
3295
return ProcessWarningRelatedSwitch(commandLineSwitches,
CommandLineSwitches
.ParameterizedSwitch.WarningsNotAsErrors);
3392
private static void StartLocalNode(
CommandLineSwitches
commandLineSwitches, bool lowpriority)
3394
string[] input = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeMode];
3411
bool nodeReuse = ProcessNodeReuseSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeReuse]);
3420
bool taskHostNodeReuse = ProcessNodeReuseSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeReuse]);
3421
byte parentPacketVersion = ProcessParentPacketVersionSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ParentPacketVersion]);
3468
OutOfProcServerNode serverNode = new(buildFunction, ProcessServerInstanceIdSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ServerInstanceId]));
3810
CommandLineSwitches
commandLineSwitches,
3822
string[] loggerSwitchParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Logger];
3823
string[] distributedLoggerSwitchParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.DistributedLogger];
3824
string[] verbositySwitchParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Verbosity];
3825
bool noConsoleLogger = commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.NoConsoleLogger];
3826
bool distributedFileLogger = commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.DistributedFileLogger];
3827
string[] fileLoggerParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.FileLoggerParameters]; // used by DistributedFileLogger
3828
string[] consoleLoggerParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ConsoleLoggerParameters];
3829
string[] binaryLoggerParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.BinaryLogger];
3830
string[] profileEvaluationParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ProfileEvaluation];
3839
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.DetailedSummary))
3841
detailedSummary = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.DetailedSummary], defaultValue: true, resourceName: "InvalidDetailedSummaryValue");
4646
private static void DisplayVersionMessageIfNeeded(bool recursing, bool useTerminalLogger, bool noLogo,
CommandLineSwitches
commandLineSwitches)
4658
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Preprocess) &&
4659
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.GetProperty) &&
4660
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.GetItem) &&
4661
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.GetTargetResult) &&
4662
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.FeatureAvailability) &&
4682
foreach (string parameterizedSwitchRsouceId in
CommandLineSwitches
.GetParameterizedSwitchResourceIds())
4686
foreach (string parameterlessSwitchRsouceId in
CommandLineSwitches
.GetParameterlessSwitchResourceIds())