From 01e462b6ba7db858e9aa378da574616070e579c7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 5 Aug 2025 20:24:04 +0000 Subject: [PATCH 1/7] Initial plan From b623d6bd4a1560738ee68967e38d93803c69f2ac Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 5 Aug 2025 20:54:27 +0000 Subject: [PATCH 2/7] Add BinaryLoggerOption as ForwardedOption to all MSBuild commands Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com> --- .../CommandLine/CommandLineOptions.cs | 39 +++---------------- .../Commands/Build/BuildCommandParser.cs | 1 + .../Commands/Clean/CleanCommandParser.cs | 1 + .../Commands/MSBuild/MSBuildForwardingApp.cs | 2 +- .../dotnet/Commands/Pack/PackCommandParser.cs | 1 + .../Commands/Publish/PublishCommandParser.cs | 1 + .../Commands/Restore/RestoreCommandParser.cs | 1 + .../dotnet/Commands/Run/RunCommandParser.cs | 1 + .../Commands/Store/StoreCommandParser.cs | 1 + .../dotnet/Commands/Test/TestCommandParser.cs | 1 + src/Cli/dotnet/CommonOptions.cs | 26 +++++++++++++ 11 files changed, 40 insertions(+), 35 deletions(-) diff --git a/src/BuiltInTools/dotnet-watch/CommandLine/CommandLineOptions.cs b/src/BuiltInTools/dotnet-watch/CommandLine/CommandLineOptions.cs index 85ecb916213e..d6168b54afa3 100644 --- a/src/BuiltInTools/dotnet-watch/CommandLine/CommandLineOptions.cs +++ b/src/BuiltInTools/dotnet-watch/CommandLine/CommandLineOptions.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Collections.Immutable; using System.CommandLine; using System.CommandLine.Parsing; using System.Data; @@ -17,8 +16,6 @@ internal sealed class CommandLineOptions { public const string DefaultCommand = "run"; - private static readonly ImmutableArray s_binaryLogOptionNames = ["-bl", "/bl", "-binaryLogger", "--binaryLogger", "/binaryLogger"]; - public bool List { get; init; } public required GlobalOptions GlobalOptions { get; init; } @@ -157,17 +154,14 @@ internal sealed class CommandLineOptions } } - var commandArguments = GetCommandArguments(parseResult, watchOptions, explicitCommand, out var binLogToken, out var binLogPath); + var commandArguments = GetCommandArguments(parseResult, watchOptions, explicitCommand); // We assume that forwarded options, if any, are intended for dotnet build. var buildArguments = buildOptions.Select(option => ((IForwardedOption)option).GetForwardingFunction()(parseResult)).SelectMany(args => args).ToList(); - if (binLogToken != null) - { - buildArguments.Add(binLogToken); - } - var targetFrameworkOption = (Option?)buildOptions.SingleOrDefault(option => option.Name == "--framework"); + var binaryLoggerOption = (Option?)buildOptions.SingleOrDefault(option => option.Name == "--binaryLogger"); + var binaryLoggerPath = binaryLoggerOption != null ? parseResult.GetValue(binaryLoggerOption) : null; return new() { @@ -178,7 +172,7 @@ internal sealed class CommandLineOptions NoHotReload = parseResult.GetValue(noHotReloadOption), NonInteractive = parseResult.GetValue(NonInteractiveOption), Verbose = parseResult.GetValue(verboseOption), - BinaryLogPath = ParseBinaryLogFilePath(binLogPath), + BinaryLogPath = ParseBinaryLogFilePath(binaryLoggerPath), }, CommandArguments = commandArguments, @@ -215,13 +209,9 @@ internal sealed class CommandLineOptions private static IReadOnlyList GetCommandArguments( ParseResult parseResult, IReadOnlyList