From 9016451620fea8f6f6c6d421533de5c70d12aa89 Mon Sep 17 00:00:00 2001 From: --get Date: Mon, 27 Oct 2025 17:04:27 -0500 Subject: [PATCH 01/16] model the usage of --nologo for MSBuild forwarding and infer it from the DOTNET_NOLOGO environment variable --- src/Cli/Microsoft.DotNet.Cli.Utils/Env.cs | 5 ++ .../EnvironmentProvider.cs | 60 ++++++++++++++++++ .../IEnvironmentProvider.cs | 7 +++ .../Microsoft.DotNet.Cli.Utils/MSBuildArgs.cs | 62 +++++++++++++++++-- .../MSBuildForwardingAppWithoutLogging.cs | 11 +--- .../Microsoft.DotNet.Cli.Utils/Polyfills.cs | 19 +++++- .../Commands/Build/BuildCommandParser.cs | 6 +- .../Commands/Clean/CleanCommandParser.cs | 10 +-- .../dotnet/Commands/CliCommandStrings.resx | 56 ++++++++--------- .../dotnet/Commands/MSBuild/MSBuildCommand.cs | 12 +++- .../Commands/MSBuild/MSBuildForwardingApp.cs | 7 +-- .../dotnet/Commands/Pack/PackCommandParser.cs | 6 +- .../Commands/Publish/PublishCommandParser.cs | 6 +- .../dotnet/Commands/Test/TestCommandParser.cs | 6 +- .../Commands/xlf/CliCommandStrings.cs.xlf | 4 +- .../Commands/xlf/CliCommandStrings.de.xlf | 14 ++--- .../Commands/xlf/CliCommandStrings.es.xlf | 6 +- .../Commands/xlf/CliCommandStrings.fr.xlf | 8 +-- .../Commands/xlf/CliCommandStrings.it.xlf | 6 +- .../Commands/xlf/CliCommandStrings.ja.xlf | 10 +-- .../Commands/xlf/CliCommandStrings.ko.xlf | 14 ++--- .../Commands/xlf/CliCommandStrings.pl.xlf | 4 +- .../Commands/xlf/CliCommandStrings.pt-BR.xlf | 4 +- .../Commands/xlf/CliCommandStrings.ru.xlf | 4 +- .../Commands/xlf/CliCommandStrings.tr.xlf | 10 +-- .../xlf/CliCommandStrings.zh-Hans.xlf | 4 +- .../xlf/CliCommandStrings.zh-Hant.xlf | 18 +++--- src/Cli/dotnet/CommonOptions.cs | 22 +++++++ .../RegistryTests.cs | 30 +++++++++ .../WindowsEnvironmentPathTests.cs | 5 ++ 30 files changed, 306 insertions(+), 130 deletions(-) diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/Env.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/Env.cs index dbedb133bfc0..c85eaa1d0bf7 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Utils/Env.cs +++ b/src/Cli/Microsoft.DotNet.Cli.Utils/Env.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Diagnostics.CodeAnalysis; + namespace Microsoft.DotNet.Cli.Utils; public static class Env @@ -21,6 +23,9 @@ public static class Env public static bool GetEnvironmentVariableAsBool(string name, bool defaultValue = false) => s_environment.GetEnvironmentVariableAsBool(name, defaultValue); + public static bool TryGetEnvironmentVariableAsBool(string name, [NotNullWhen(true)] out bool value) => + s_environment.TryGetEnvironmentVariableAsBool(name, out value); + public static int? GetEnvironmentVariableAsNullableInt(string name) => s_environment.GetEnvironmentVariableAsNullableInt(name); diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/EnvironmentProvider.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/EnvironmentProvider.cs index 50984a692d1c..06c64b67110a 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Utils/EnvironmentProvider.cs +++ b/src/Cli/Microsoft.DotNet.Cli.Utils/EnvironmentProvider.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Diagnostics.CodeAnalysis; using Microsoft.DotNet.Cli.Utils.Extensions; namespace Microsoft.DotNet.Cli.Utils; @@ -136,6 +137,12 @@ public bool GetEnvironmentVariableAsBool(string name, bool defaultValue) return Environment.GetEnvironmentVariable(variable, target); } + public bool TryGetEnvironmentVariable(string name, [NotNullWhen(true)] out string? value) + { + value = Environment.GetEnvironmentVariable(name); + return value != null; + } + public void SetEnvironmentVariable(string variable, string value, EnvironmentVariableTarget target) { Environment.SetEnvironmentVariable(variable, value, target); @@ -150,4 +157,57 @@ public void SetEnvironmentVariable(string variable, string value, EnvironmentVar return null; } + + public bool TryGetEnvironmentVariableAsBool(string name, [NotNullWhen(true)] out bool value) + { + if (TryGetEnvironmentVariable(name, out string? strValue) && + (bool.TryParse(strValue, out bool boolValue) + || TryParseNonBoolConstantStringAsBool(strValue, out boolValue))) + { + value = boolValue; + return true; + } + else + { + value = false; + return false; + } + } + + /// + /// Parses non-boolean constant strings like "1", "0", "yes", "no", "on", "off" as boolean values. + /// + private static bool TryParseNonBoolConstantStringAsBool(string? strValue, out bool value) + { + switch (strValue?.ToLowerInvariant()) + { + case "1": + case "yes": + case "on": + value = true; + return true; + case "0": + case "no": + case "off": + value = false; + return true; + default: + value = false; + return false; + } + } + + public bool TryGetEnvironmentVariableAsInt(string name, [NotNullWhen(true)] out int value) + { + if (TryGetEnvironmentVariable(name, out string? strValue) && int.TryParse(strValue, out int intValue)) + { + value = intValue; + return true; + } + else + { + value = -1; + return false; + } + } } diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/IEnvironmentProvider.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/IEnvironmentProvider.cs index 385f989d4990..8aaacf30fbad 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Utils/IEnvironmentProvider.cs +++ b/src/Cli/Microsoft.DotNet.Cli.Utils/IEnvironmentProvider.cs @@ -3,6 +3,9 @@ namespace Microsoft.DotNet.Cli.Utils; +using System.Diagnostics.CodeAnalysis; + + public interface IEnvironmentProvider { IEnumerable ExecutableExtensions { get; } @@ -19,6 +22,10 @@ public interface IEnvironmentProvider string? GetEnvironmentVariable(string name); + bool TryGetEnvironmentVariable(string name, [NotNullWhen(true)] out string? value); + bool TryGetEnvironmentVariableAsBool(string name, [NotNullWhen(true)] out bool value); + bool TryGetEnvironmentVariableAsInt(string name, [NotNullWhen(true)] out int value); + string? GetEnvironmentVariable(string variable, EnvironmentVariableTarget target); void SetEnvironmentVariable(string variable, string value, EnvironmentVariableTarget target); diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildArgs.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildArgs.cs index 12226f42f0d6..a631b3575084 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildArgs.cs +++ b/src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildArgs.cs @@ -21,7 +21,9 @@ private MSBuildArgs( string[]? getTargetResult, string[]? getResultOutputFile, VerbosityOptions? verbosity, - string[]? otherMSBuildArgs) + bool noLogo, + string[]? otherMSBuildArgs + ) { GlobalProperties = properties; RestoreGlobalProperties = restoreProperties; @@ -31,6 +33,7 @@ private MSBuildArgs( GetTargetResult = getTargetResult; GetResultOutputFile = getResultOutputFile; Verbosity = verbosity; + NoLogo = noLogo; OtherMSBuildArgs = otherMSBuildArgs is not null ? [.. otherMSBuildArgs] : new List(); @@ -51,16 +54,33 @@ private MSBuildArgs( /// public string[]? RequestedTargets { get; } + /// + /// If specified, the list of MSBuild Property names to retrieve and report directly for this build of a single project. + /// public string[]? GetProperty { get; } + /// + /// If specified, the list of MSBuild Item names to retrieve and report directly for this build of a single project. + /// public string[]? GetItem { get; } + /// + /// If specified, the list of MSBuild Target Output/Return Items to retrieve and report directly for this build of a single project. + /// public string[]? GetTargetResult { get; } + /// + /// If specified, the list of output files to which to write --getProperty, --getItem, and --getTargetResult outputs. + /// public string[]? GetResultOutputFile { get; } public VerbosityOptions? Verbosity { get; } + /// + /// Wether or not the MSBuild product header text should be emitted at the start of this build + /// + public bool NoLogo { get; } + /// /// All other arguments that aren't already explicitly modeled by this structure. /// The main categories of these today are logger configurations @@ -99,6 +119,9 @@ public static MSBuildArgs AnalyzeMSBuildArguments(IEnumerable forwardedA var verbosity = parseResult.GetResult("--verbosity") is OptionResult verbosityResult ? verbosityResult.GetValueOrDefault() : null; + var nologo = parseResult.GetResult("--nologo") is OptionResult nologoResult + ? nologoResult.GetValueOrDefault() + : false; var otherMSBuildArgs = parseResult.UnmatchedTokens.ToArray(); return new MSBuildArgs( properties: globalProperties, @@ -109,7 +132,8 @@ public static MSBuildArgs AnalyzeMSBuildArguments(IEnumerable forwardedA getTargetResult: getTargetResult, getResultOutputFile: getResultOutputFile, otherMSBuildArgs: otherMSBuildArgs, - verbosity: verbosity); + verbosity: verbosity, + noLogo: nologo); T? TryGetValue(string name) { @@ -120,19 +144,19 @@ public static MSBuildArgs AnalyzeMSBuildArguments(IEnumerable forwardedA public static MSBuildArgs FromProperties(ReadOnlyDictionary? properties) { - return new MSBuildArgs(properties, null, null, null, null, null, null, null, null); + return new MSBuildArgs(properties, null, null, null, null, null, null, null, noLogo: false, null); } public static MSBuildArgs FromOtherArgs(params ReadOnlySpan args) { - return new MSBuildArgs(null, null, null, null, null, null, null, null, args.ToArray()); + return new MSBuildArgs(null, null, null, null, null, null, null, null, noLogo: false, args.ToArray()); } public static MSBuildArgs FromVerbosity(VerbosityOptions verbosity) { - return new MSBuildArgs(null, null, null, null, null, null, null, verbosity, null); + return new MSBuildArgs(null, null, null, null, null, null, null, verbosity, noLogo: false, null); } - public static readonly MSBuildArgs ForHelp = new(null, null, null, null, null, null, null, null, ["--help"]); + public static readonly MSBuildArgs ForHelp = new(null, null, null, null, null, null, null, null, noLogo: true, ["--help"]); /// /// Completely replaces the MSBuild arguments with the provided . @@ -148,6 +172,7 @@ public MSBuildArgs CloneWithExplicitArgs(string[] newArgs) getTargetResult: GetTargetResult, getResultOutputFile: GetResultOutputFile, otherMSBuildArgs: newArgs, + noLogo: NoLogo, verbosity: Verbosity); } @@ -168,6 +193,7 @@ public MSBuildArgs CloneWithAdditionalArgs(params string[] additionalArgs) GetTargetResult, GetResultOutputFile, Verbosity, + NoLogo, OtherMSBuildArgs.ToArray()); } @@ -180,6 +206,7 @@ public MSBuildArgs CloneWithAdditionalArgs(params string[] additionalArgs) GetTargetResult, GetResultOutputFile, Verbosity, + NoLogo, [.. OtherMSBuildArgs, .. additionalArgs]); } @@ -197,6 +224,7 @@ public MSBuildArgs CloneWithAdditionalRestoreProperties(ReadOnlyDictionary additi GetTargetResult, GetResultOutputFile, Verbosity, + NoLogo, OtherMSBuildArgs.ToArray()); } @@ -305,6 +339,22 @@ public MSBuildArgs CloneWithVerbosity(VerbosityOptions newVerbosity) GetTargetResult, GetResultOutputFile, newVerbosity, + NoLogo, + OtherMSBuildArgs.ToArray()); + } + + public MSBuildArgs CloneWithNoLogo(bool noLogo) + { + return new MSBuildArgs( + GlobalProperties, + RestoreGlobalProperties, + RequestedTargets, + GetProperty, + GetItem, + GetTargetResult, + GetResultOutputFile, + Verbosity, + noLogo, OtherMSBuildArgs.ToArray()); } diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs index e0dca709ac3c..87d021eda157 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs +++ b/src/Cli/Microsoft.DotNet.Cli.Utils/MSBuildForwardingAppWithoutLogging.cs @@ -44,17 +44,11 @@ public static string MSBuildVersion private readonly List _msbuildRequiredParameters = ["-maxcpucount", $"--verbosity:{DefaultVerbosity}"]; - public MSBuildForwardingAppWithoutLogging(MSBuildArgs msbuildArgs, string? msbuildPath = null, bool includeLogo = false, bool isRestoring = true) + public MSBuildForwardingAppWithoutLogging(MSBuildArgs msbuildArgs, string? msbuildPath = null) { string defaultMSBuildPath = GetMSBuildExePath(); _msbuildArgs = msbuildArgs; - if (!includeLogo && !msbuildArgs.OtherMSBuildArgs.Contains("-nologo", StringComparer.OrdinalIgnoreCase)) - { - // If the user didn't explicitly ask for -nologo, we add it to avoid the MSBuild logo. - // This is useful for scenarios like restore where we don't want to print the logo. - // Note that this is different from the default behavior of MSBuild, which prints the logo. - msbuildArgs.OtherMSBuildArgs.Add("-nologo"); - } + string? tlpDefault = TerminalLoggerDefault; if (string.IsNullOrWhiteSpace(tlpDefault)) { @@ -101,6 +95,7 @@ private string[] EmitMSBuildArgs(MSBuildArgs msbuildArgs) => [ .. msbuildArgs.RestoreGlobalProperties?.Select(kvp => EmitProperty(kvp, "restoreProperty")) ?? [], .. msbuildArgs.RequestedTargets?.Select(target => $"--target:{target}") ?? [], .. msbuildArgs.Verbosity is not null ? new string[1] { $"--verbosity:{msbuildArgs.Verbosity}" } : [], + .. msbuildArgs.NoLogo is true ? new string[1] { "--nologo" } : [], .. msbuildArgs.OtherMSBuildArgs ]; diff --git a/src/Cli/Microsoft.DotNet.Cli.Utils/Polyfills.cs b/src/Cli/Microsoft.DotNet.Cli.Utils/Polyfills.cs index ab674a2906ee..59668dbae394 100644 --- a/src/Cli/Microsoft.DotNet.Cli.Utils/Polyfills.cs +++ b/src/Cli/Microsoft.DotNet.Cli.Utils/Polyfills.cs @@ -4,11 +4,24 @@ #if NET472 #pragma warning disable IDE0130 // Namespace does not match folder structure -namespace System.Runtime.CompilerServices; -#pragma warning restore IDE0130 // Namespace does not match folder structure +namespace System.Runtime.CompilerServices { + + internal static class IsExternalInit + { + } + +} -internal static class IsExternalInit +namespace System.Diagnostics.CodeAnalysis { + [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] + internal sealed class NotNullWhenAttribute : Attribute + { + public NotNullWhenAttribute(bool returnValue) => ReturnValue = returnValue; + + public bool ReturnValue { get; } + } } +#pragma warning restore IDE0130 // Namespace does not match folder structure #endif diff --git a/src/Cli/dotnet/Commands/Build/BuildCommandParser.cs b/src/Cli/dotnet/Commands/Build/BuildCommandParser.cs index 74b4efa2a712..be2e52c45263 100644 --- a/src/Cli/dotnet/Commands/Build/BuildCommandParser.cs +++ b/src/Cli/dotnet/Commands/Build/BuildCommandParser.cs @@ -36,11 +36,7 @@ internal static class BuildCommandParser Arity = ArgumentArity.Zero }.ForwardAs("--property:BuildProjectReferences=false"); - public static readonly Option NoLogoOption = new Option("--nologo") - { - Description = CliCommandStrings.BuildCmdNoLogo, - Arity = ArgumentArity.Zero - }.ForwardAs("-nologo"); + public static readonly Option NoLogoOption = CommonOptions.NoLogoOption(); public static readonly Option NoRestoreOption = CommonOptions.NoRestoreOption; diff --git a/src/Cli/dotnet/Commands/Clean/CleanCommandParser.cs b/src/Cli/dotnet/Commands/Clean/CleanCommandParser.cs index 24e83acc8b64..117537d7fd1f 100644 --- a/src/Cli/dotnet/Commands/Clean/CleanCommandParser.cs +++ b/src/Cli/dotnet/Commands/Clean/CleanCommandParser.cs @@ -24,15 +24,11 @@ internal static class CleanCommandParser HelpName = CliCommandStrings.CleanCmdOutputDir }.ForwardAsOutputPath("OutputPath"); - public static readonly Option NoLogoOption = new Option("--nologo") - { - Description = CliCommandStrings.CleanCmdNoLogo, - Arity = ArgumentArity.Zero - }.ForwardAs("-nologo"); + public static readonly Option NoLogoOption = CommonOptions.NoLogoOption(); - public static readonly Option FrameworkOption = CommonOptions.FrameworkOption(CliCommandStrings.CleanFrameworkOptionDescription); + public static readonly Option FrameworkOption = CommonOptions.FrameworkOption(CliCommandStrings.CleanFrameworkOptionDescription); - public static readonly Option ConfigurationOption = CommonOptions.ConfigurationOption(CliCommandStrings.CleanConfigurationOptionDescription); + public static readonly Option ConfigurationOption = CommonOptions.ConfigurationOption(CliCommandStrings.CleanConfigurationOptionDescription); public static readonly Option TargetOption = CommonOptions.RequiredMSBuildTargetOption("Clean"); diff --git a/src/Cli/dotnet/Commands/CliCommandStrings.resx b/src/Cli/dotnet/Commands/CliCommandStrings.resx index 4fbcfb5e5d2b..9b0d499e7d9d 100644 --- a/src/Cli/dotnet/Commands/CliCommandStrings.resx +++ b/src/Cli/dotnet/Commands/CliCommandStrings.resx @@ -1,17 +1,17 @@  - @@ -166,7 +166,7 @@ .NET Builder - + Do not display the startup banner or the copyright message. diff --git a/src/Cli/dotnet/Commands/MSBuild/MSBuildCommand.cs b/src/Cli/dotnet/Commands/MSBuild/MSBuildCommand.cs index d7edaea57478..7e28945067a3 100644 --- a/src/Cli/dotnet/Commands/MSBuild/MSBuildCommand.cs +++ b/src/Cli/dotnet/Commands/MSBuild/MSBuildCommand.cs @@ -11,7 +11,17 @@ namespace Microsoft.DotNet.Cli.Commands.MSBuild; public class MSBuildCommand( IEnumerable msbuildArgs, string? msbuildPath = null -) : MSBuildForwardingApp(MSBuildArgs.AnalyzeMSBuildArguments([..msbuildArgs], CommonOptions.PropertiesOption, CommonOptions.RestorePropertiesOption, MSBuildCommandParser.TargetOption, CommonOptions.VerbosityOption()), msbuildPath, includeLogo: true) +) : MSBuildForwardingApp(MSBuildArgs.AnalyzeMSBuildArguments( + [.. msbuildArgs], + CommonOptions.PropertiesOption, + CommonOptions.RestorePropertiesOption, + MSBuildCommandParser.TargetOption, + CommonOptions.VerbosityOption(), + // We set the no-logo option to false here to ensure that by default the logo is shown for this command. + // This is different from other commands that default to hiding the logo - but this command is meant to mimic + // the behavior of calling MSBuild directly, which shows the logo by default. + CommonOptions.NoLogoOption(false) + ), msbuildPath) { public static MSBuildCommand FromArgs(string[] args, string? msbuildPath = null) { diff --git a/src/Cli/dotnet/Commands/MSBuild/MSBuildForwardingApp.cs b/src/Cli/dotnet/Commands/MSBuild/MSBuildForwardingApp.cs index 3055de0883f5..df0eaf4d166a 100644 --- a/src/Cli/dotnet/Commands/MSBuild/MSBuildForwardingApp.cs +++ b/src/Cli/dotnet/Commands/MSBuild/MSBuildForwardingApp.cs @@ -42,18 +42,17 @@ private static MSBuildArgs ConcatTelemetryLogger(MSBuildArgs msbuildArgs) /// Mostly intended for quick/one-shot usage - most 'core' SDK commands should do more hands-on parsing. /// public MSBuildForwardingApp(IEnumerable rawMSBuildArgs, string? msbuildPath = null) : this( - MSBuildArgs.AnalyzeMSBuildArguments(rawMSBuildArgs.ToArray(), CommonOptions.PropertiesOption, CommonOptions.RestorePropertiesOption, CommonOptions.MSBuildTargetOption(), CommonOptions.VerbosityOption()), + MSBuildArgs.AnalyzeMSBuildArguments(rawMSBuildArgs.ToArray(), CommonOptions.PropertiesOption, CommonOptions.RestorePropertiesOption, CommonOptions.MSBuildTargetOption(), CommonOptions.VerbosityOption(), CommonOptions.NoLogoOption()), msbuildPath) { } - public MSBuildForwardingApp(MSBuildArgs msBuildArgs, string? msbuildPath = null, bool includeLogo = false) + public MSBuildForwardingApp(MSBuildArgs msBuildArgs, string? msbuildPath = null) { var modifiedMSBuildArgs = CommonRunHelpers.AdjustMSBuildForLLMs(ConcatTelemetryLogger(msBuildArgs)); _forwardingAppWithoutLogging = new MSBuildForwardingAppWithoutLogging( modifiedMSBuildArgs, - msbuildPath: msbuildPath, - includeLogo: includeLogo); + msbuildPath: msbuildPath); // Add the performance log location to the environment of the target process. if (PerformanceLogManager.Instance != null && !string.IsNullOrEmpty(PerformanceLogManager.Instance.CurrentLogDirectory)) diff --git a/src/Cli/dotnet/Commands/Pack/PackCommandParser.cs b/src/Cli/dotnet/Commands/Pack/PackCommandParser.cs index a57aa2fabfcd..23fc1ef58f69 100644 --- a/src/Cli/dotnet/Commands/Pack/PackCommandParser.cs +++ b/src/Cli/dotnet/Commands/Pack/PackCommandParser.cs @@ -49,11 +49,7 @@ internal static class PackCommandParser Arity = ArgumentArity.Zero }.ForwardAs("-property:Serviceable=true"); - public static readonly Option NoLogoOption = new Option("--nologo") - { - Description = CliCommandStrings.PackCmdNoLogo, - Arity = ArgumentArity.Zero - }.ForwardAs("-nologo"); + public static readonly Option NoLogoOption = CommonOptions.NoLogoOption(); public static readonly Option NoRestoreOption = CommonOptions.NoRestoreOption; diff --git a/src/Cli/dotnet/Commands/Publish/PublishCommandParser.cs b/src/Cli/dotnet/Commands/Publish/PublishCommandParser.cs index 9fbe305d4877..2c2b1b20e36f 100644 --- a/src/Cli/dotnet/Commands/Publish/PublishCommandParser.cs +++ b/src/Cli/dotnet/Commands/Publish/PublishCommandParser.cs @@ -38,11 +38,7 @@ internal static class PublishCommandParser Arity = ArgumentArity.Zero }.ForwardAs("-property:NoBuild=true"); - public static readonly Option NoLogoOption = new Option("--nologo") - { - Description = CliCommandStrings.PublishCmdNoLogo, - Arity = ArgumentArity.Zero - }.ForwardAs("-nologo"); + public static readonly Option NoLogoOption = CommonOptions.NoLogoOption(); public static readonly Option NoRestoreOption = CommonOptions.NoRestoreOption; diff --git a/src/Cli/dotnet/Commands/Test/TestCommandParser.cs b/src/Cli/dotnet/Commands/Test/TestCommandParser.cs index b8200bd722e1..ede36d96b40d 100644 --- a/src/Cli/dotnet/Commands/Test/TestCommandParser.cs +++ b/src/Cli/dotnet/Commands/Test/TestCommandParser.cs @@ -154,11 +154,7 @@ private static Option CreateBlameHangDumpOption() HelpName = CliCommandStrings.HangTimeoutArgumentName }.ForwardAsMany(o => ["-property:VSTestBlameHang=true", $"-property:VSTestBlameHangTimeout={o}"]); - public static readonly Option NoLogoOption = new Option("--nologo") - { - Description = CliCommandStrings.TestCmdNoLogo, - Arity = ArgumentArity.Zero - }.ForwardIfEnabled("-property:VSTestNoLogo=true"); + public static readonly Option NoLogoOption = CommonOptions.NoLogoOption(forwardAs: "-property:VSTestNoLogo=true"); public static readonly Option NoRestoreOption = CommonOptions.NoRestoreOption; diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf index 91f846e1ab62..cea514804dec 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf @@ -92,7 +92,7 @@ .NET Builder - - - - \ No newline at end of file + diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf index 8b7c023e949c..12488ea48720 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf @@ -92,7 +92,7 @@ Générateur .NET - - \ No newline at end of file + diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf index fdf9fb3bd31b..3621e5f0b97d 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf @@ -92,7 +92,7 @@ Generatore .NET - - - - - - - - \ No newline at end of file + diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf index 42bc47df39af..df6cce3dd9fa 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf @@ -92,7 +92,7 @@ .NET 生成器 - - - OUTPUT_DIR OUTPUT_DIR @@ -1932,11 +1927,6 @@ Nástroj {1} (verze {2}) se úspěšně nainstaloval. Do souboru manifestu {3} s Nástroj .NET Core pro balení balíčku NuGet - OUTPUT_DIR OUTPUT_DIR @@ -2480,11 +2470,6 @@ Nástroj {1} (verze {2}) se úspěšně nainstaloval. Do souboru manifestu {3} s Vydavatel pro platformu .NET - The configuration to publish for. The default is 'Release' for NET 8.0 projects and above, but 'Debug' for older projects. Konfigurace, pro kterou se má publikovat. Pro projekty NET 8.0 a vyšší je výchozí hodnota Release, ale pro starší projekty je hodnota Debug. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf index 6af91eb6c2b4..451f2ccc2f5a 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf @@ -229,11 +229,6 @@ Durchsuchte Pfade: "{1}", "{2}". .NET-Befehl "Clean" - OUTPUT_DIR OUTPUT_DIR @@ -1932,11 +1927,6 @@ Das Tool "{1}" (Version {2}) wurde erfolgreich installiert. Der Eintrag wird der .NET Core NuGet Package Packer - OUTPUT_DIR OUTPUT_DIR @@ -2480,11 +2470,6 @@ Das Tool "{1}" (Version {2}) wurde erfolgreich installiert. Der Eintrag wird der Herausgeber für die .NET-Plattform - The configuration to publish for. The default is 'Release' for NET 8.0 projects and above, but 'Debug' for older projects. Die Konfiguration, für die veröffentlicht werden soll. Der Standardwert ist "Release" für NET 8.0-Projekte und höher, aber "Debug" für ältere Projekte. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf index 661f4cd71d70..602df59ae22b 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf @@ -229,11 +229,6 @@ Rutas de acceso buscadas: "{1}", "{2}". Comando Clean de .NET - OUTPUT_DIR OUTPUT_DIR @@ -1932,11 +1927,6 @@ La herramienta "{1}" (versión "{2}") se instaló correctamente. Se ha agregado .NET Core NuGet Package Packer - OUTPUT_DIR OUTPUT_DIR @@ -2480,11 +2470,6 @@ La herramienta "{1}" (versión "{2}") se instaló correctamente. Se ha agregado Publicador para la plataforma .NET - The configuration to publish for. The default is 'Release' for NET 8.0 projects and above, but 'Debug' for older projects. Configuración para la que se va a publicar. El valor predeterminado es "Versión" para proyectos de NET 8.0 y versiones posteriores, pero "Depurar" para proyectos anteriores. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf index 12488ea48720..420523dd6317 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf @@ -229,11 +229,6 @@ Les chemins d’accès ont recherché : « {1} », « {2} ». Commande de nettoyage .NET - OUTPUT_DIR OUTPUT_DIR @@ -1932,11 +1927,6 @@ L'outil '{1}' (version '{2}') a été correctement installé. L'entrée est ajou Compresseur de package NuGet .NET Core - OUTPUT_DIR OUTPUT_DIR @@ -2480,11 +2470,6 @@ L'outil '{1}' (version '{2}') a été correctement installé. L'entrée est ajou Éditeur pour la plateforme .NET - The configuration to publish for. The default is 'Release' for NET 8.0 projects and above, but 'Debug' for older projects. Configuration pour lequel publier. La valeur par défaut est « Release » pour les projets NET 8.0 et versions ultérieures, mais « Debug » pour les projets plus anciens. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf index 3621e5f0b97d..51634ff32480 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf @@ -229,11 +229,6 @@ Percorsi cercati: '{1}', '{2}'. Comando di pulizia .NET - OUTPUT_DIR OUTPUT_DIR @@ -1932,11 +1927,6 @@ Lo strumento '{1}' versione '{2}' è stato installato. La voce è stata aggiunta Strumento di creazione pacchetti NuGet di .NET Core - OUTPUT_DIR OUTPUT_DIR @@ -2480,11 +2470,6 @@ Lo strumento '{1}' versione '{2}' è stato installato. La voce è stata aggiunta Editore per la piattaforma .NET - The configuration to publish for. The default is 'Release' for NET 8.0 projects and above, but 'Debug' for older projects. Configurazione per la pubblicazione. Il valore predefinito per i progetti NET 8.0 e versioni successive è 'Release', ma per i progetti meno recenti è 'Debug'. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf index 7c5a366a5306..c0081e525ea6 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf @@ -229,11 +229,6 @@ Paths searched: '{1}', '{2}'. .NET Clean コマンド - OUTPUT_DIR OUTPUT_DIR @@ -1932,11 +1927,7 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man .NET Core NuGet パッケージ パッカー - + OUTPUT_DIR OUTPUT_DIR @@ -2480,11 +2471,6 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man .NET Platform 用パブリッシャー - The configuration to publish for. The default is 'Release' for NET 8.0 projects and above, but 'Debug' for older projects. 発行する構成。既定値は、NET 8.0 以降のプロジェクトの場合は 'Release' ですが、旧プロジェクトの場合は 'Debug' です。 diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf index 7b267c2af303..9bc8643027c0 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf @@ -229,11 +229,6 @@ Paths searched: '{1}', '{2}'. .NET 정리 명령 - OUTPUT_DIR OUTPUT_DIR @@ -1932,11 +1927,6 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man .NET Core NuGet 패키지 패커 - OUTPUT_DIR OUTPUT_DIR @@ -2480,11 +2470,6 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man .NET 플랫폼용 게시자입니다. - The configuration to publish for. The default is 'Release' for NET 8.0 projects and above, but 'Debug' for older projects. 게시할 구성입니다. 기본값은 NET 8.0 프로젝트의 경우 'Release'이지만, 이전 프로젝트의 경우 'Debug'입니다. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf index 1372c7af5237..175ac52a189b 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf @@ -229,11 +229,6 @@ Przeszukane ścieżki: „{1}”, „{2}”. Polecenie clean platformy .NET - OUTPUT_DIR OUTPUT_DIR @@ -1932,11 +1927,6 @@ Narzędzie „{1}” (wersja „{2}”) zostało pomyślnie zainstalowane. Wpis Tworzenie pakietów NuGet w programie .NET Core - OUTPUT_DIR OUTPUT_DIR @@ -2480,11 +2470,6 @@ Narzędzie „{1}” (wersja „{2}”) zostało pomyślnie zainstalowane. Wpis Wydawca dla platformy .NET. - The configuration to publish for. The default is 'Release' for NET 8.0 projects and above, but 'Debug' for older projects. Konfiguracja do opublikowania. Wartość domyślna to „Wersja” dla projektów NET 8.0 i nowszych, ale „Debugowanie” dla starszych projektów. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf index 38effd6bd6c9..3aba8ac88a6c 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf @@ -229,11 +229,6 @@ Caminhos pesquisados: "{1}", "{2}". Comando Clean do .NET - OUTPUT_DIR OUTPUT_DIR @@ -1932,11 +1927,6 @@ A ferramenta '{1}' (versão '{2}') foi instalada com êxito. A entrada foi adici Empacotador de Pacotes NuGet do .NET Core - OUTPUT_DIR OUTPUT_DIR @@ -2480,11 +2470,6 @@ A ferramenta '{1}' (versão '{2}') foi instalada com êxito. A entrada foi adici Editor para a Plataforma .NET - The configuration to publish for. The default is 'Release' for NET 8.0 projects and above, but 'Debug' for older projects. A configuração para a qual publicar. O padrão é 'Release' para projetos NET 8.0 e superiores, mas 'Debug' para projetos mais antigos. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf index 3d143ad8df4c..285f17f59043 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf @@ -229,11 +229,6 @@ Paths searched: '{1}', '{2}'. Команда .NET Clean - OUTPUT_DIR OUTPUT_DIR @@ -1932,11 +1927,6 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man Упаковщик пакетов NuGet .NET Core - OUTPUT_DIR OUTPUT_DIR @@ -2480,11 +2470,6 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man Издатель для платформы .NET - The configuration to publish for. The default is 'Release' for NET 8.0 projects and above, but 'Debug' for older projects. Конфигурация для публикации. Значение по умолчанию — "Release" для проектов NET 8.0 и более поздней версии, но "Debug" для более старых проектов. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf index 1bc77e786ec0..15f4ee6866d1 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf @@ -229,11 +229,6 @@ Aranan yollar: '{1}', '{2}'. .NET Clean Komutu - OUTPUT_DIR OUTPUT_DIR @@ -1932,11 +1927,6 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man .NET Core NuGet Paketi Paketleyicisi - OUTPUT_DIR OUTPUT_DIR @@ -2480,11 +2470,6 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man .NET Platformunun yayımcısı. - The configuration to publish for. The default is 'Release' for NET 8.0 projects and above, but 'Debug' for older projects. Yayımlanacak yapılandırma. NET 8.0 projeleri ve üzeri için varsayılan değer 'Release' iken eski projeler için değer 'Debug' olmalıdır. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf index df6cce3dd9fa..5d926d853b92 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf @@ -229,11 +229,6 @@ Paths searched: '{1}', '{2}'. .NET 清理命令 - OUTPUT_DIR OUTPUT_DIR @@ -1932,11 +1927,6 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man .NET Core NuGet 包打包程序 - OUTPUT_DIR OUTPUT_DIR @@ -2480,11 +2470,6 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man 适用于 .NET 平台的发布服务器 - The configuration to publish for. The default is 'Release' for NET 8.0 projects and above, but 'Debug' for older projects. 发布所对应的配置。对于 NET 8.0 及更高版本的项目,默认值为 "Release",但对于较低版本的项目,默认值为 "Debug"。 diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf index 50a81cbe63a3..12c8075de8b4 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf @@ -229,11 +229,6 @@ Paths searched: '{1}', '{2}'. .NET 清除命令 - OUTPUT_DIR OUTPUT_DIR @@ -1932,11 +1927,6 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man .NET Core NuGet 套件封裝器 - OUTPUT_DIR OUTPUT_DIR @@ -2480,11 +2470,6 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man .NET 平台的發行者 - The configuration to publish for. The default is 'Release' for NET 8.0 projects and above, but 'Debug' for older projects. 要發佈的設定。.NET 8.0 專案及更新版本的預設值為 'Release',但較舊專案的預設值為 'Debug'。 diff --git a/src/Cli/dotnet/CommonOptions.cs b/src/Cli/dotnet/CommonOptions.cs index 33363131bf5b..fb9f5b37b9d6 100644 --- a/src/Cli/dotnet/CommonOptions.cs +++ b/src/Cli/dotnet/CommonOptions.cs @@ -410,11 +410,11 @@ private static IReadOnlyDictionary ParseEnvironmentVariables(Arg /// /// Finally, if neither the option nor the environment variable is set, the option will default to the provided . /// - public static Option NoLogoOption(bool defaultValue = true, string forwardAs = "-nologo") + public static Option NoLogoOption(bool defaultValue = true, string forwardAs = "-nologo", string? description = null) { return new Option("--nologo") { - Description = Commands.CliCommandStrings.NoLogoOptionDescription, + Description = description ?? Commands.CliCommandStrings.NoLogoOptionDescription, DefaultValueFactory = (ar) => Env.TryGetEnvironmentVariableAsBool("DOTNET_NOLOGO", out bool value) ? value : defaultValue, CustomParser = (ar) => true, Arity = ArgumentArity.Zero From 1515315228c358b85d81a54d574c85038015d38b Mon Sep 17 00:00:00 2001 From: --get Date: Wed, 29 Oct 2025 10:15:12 -0500 Subject: [PATCH 03/16] ensure that nologo is flowed through in all calls to parse msbuild args --- .../CommandResolution/ProjectToolsCommandResolver.cs | 2 +- src/Cli/dotnet/Commands/Build/BuildCommand.cs | 2 +- src/Cli/dotnet/Commands/Clean/CleanCommand.cs | 2 +- src/Cli/dotnet/Commands/CommandFactory.cs | 1 + src/Cli/dotnet/Commands/Pack/PackCommand.cs | 1 + src/Cli/dotnet/Commands/Publish/PublishCommand.cs | 2 +- src/Cli/dotnet/Commands/Restore/RestoreCommand.cs | 2 +- src/Cli/dotnet/Commands/Restore/RestoreCommandParser.cs | 1 + src/Cli/dotnet/Commands/Test/MTP/MSBuildUtility.cs | 6 +++--- src/Cli/dotnet/Commands/Test/VSTest/TestCommand.cs | 3 ++- .../CommandTests/MSBuild/GivenDotnetRunInvocation.cs | 2 +- 11 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Cli/dotnet/CommandFactory/CommandResolution/ProjectToolsCommandResolver.cs b/src/Cli/dotnet/CommandFactory/CommandResolution/ProjectToolsCommandResolver.cs index 2f8bb7badd98..aa844850e316 100644 --- a/src/Cli/dotnet/CommandFactory/CommandResolution/ProjectToolsCommandResolver.cs +++ b/src/Cli/dotnet/CommandFactory/CommandResolution/ProjectToolsCommandResolver.cs @@ -385,7 +385,7 @@ internal void GenerateDepsJsonFile( string? stdOut; string? stdErr; - var msbuildArgs = MSBuildArgs.AnalyzeMSBuildArguments([..args], CommonOptions.PropertiesOption, CommonOptions.RestorePropertiesOption, BuildCommandParser.TargetOption, BuildCommandParser.VerbosityOption); + var msbuildArgs = MSBuildArgs.AnalyzeMSBuildArguments([..args], CommonOptions.PropertiesOption, CommonOptions.RestorePropertiesOption, BuildCommandParser.TargetOption, BuildCommandParser.VerbosityOption, BuildCommandParser.NoLogoOption); var forwardingAppWithoutLogging = new MSBuildForwardingAppWithoutLogging(msbuildArgs, msBuildExePath); if (forwardingAppWithoutLogging.ExecuteMSBuildOutOfProc) { diff --git a/src/Cli/dotnet/Commands/Build/BuildCommand.cs b/src/Cli/dotnet/Commands/Build/BuildCommand.cs index 3d8943315a94..264abdad7d80 100644 --- a/src/Cli/dotnet/Commands/Build/BuildCommand.cs +++ b/src/Cli/dotnet/Commands/Build/BuildCommand.cs @@ -43,7 +43,7 @@ public static CommandBase FromParseResult(ParseResult parseResult, string? msbui noRestore: noRestore, msbuildPath: msbuildPath ), - [CommonOptions.PropertiesOption, CommonOptions.RestorePropertiesOption, BuildCommandParser.TargetOption, BuildCommandParser.VerbosityOption], + [CommonOptions.PropertiesOption, CommonOptions.RestorePropertiesOption, BuildCommandParser.TargetOption, BuildCommandParser.VerbosityOption, BuildCommandParser.NoLogoOption], parseResult, msbuildPath ); diff --git a/src/Cli/dotnet/Commands/Clean/CleanCommand.cs b/src/Cli/dotnet/Commands/Clean/CleanCommand.cs index 1290b8b68cfd..c7e48c376ee9 100644 --- a/src/Cli/dotnet/Commands/Clean/CleanCommand.cs +++ b/src/Cli/dotnet/Commands/Clean/CleanCommand.cs @@ -33,7 +33,7 @@ public static CommandBase FromParseResult(ParseResult result, string? msbuildPat NoWriteBuildMarkers = true, }, static (msbuildArgs, msbuildPath) => new CleanCommand(msbuildArgs, msbuildPath), - [ CommonOptions.PropertiesOption, CommonOptions.RestorePropertiesOption, CleanCommandParser.TargetOption, CleanCommandParser.VerbosityOption ], + [ CommonOptions.PropertiesOption, CommonOptions.RestorePropertiesOption, CleanCommandParser.TargetOption, CleanCommandParser.VerbosityOption, CleanCommandParser.NoLogoOption], result, msbuildPath ); diff --git a/src/Cli/dotnet/Commands/CommandFactory.cs b/src/Cli/dotnet/Commands/CommandFactory.cs index 40bc500082b3..5e3adfb279d3 100644 --- a/src/Cli/dotnet/Commands/CommandFactory.cs +++ b/src/Cli/dotnet/Commands/CommandFactory.cs @@ -32,6 +32,7 @@ internal static CommandBase CreateVirtualOrPhysicalCommand( CommonOptions.GetItemOption, CommonOptions.GetTargetResultOption, CommonOptions.GetResultOutputFileOption, + CommonOptions.NoLogoOption() ]); msbuildArgs = transformer?.Invoke(msbuildArgs) ?? msbuildArgs; return configureVirtualCommand(msbuildArgs, Path.GetFullPath(arg)); diff --git a/src/Cli/dotnet/Commands/Pack/PackCommand.cs b/src/Cli/dotnet/Commands/Pack/PackCommand.cs index 57342f67bad2..9f31bfa145fe 100644 --- a/src/Cli/dotnet/Commands/Pack/PackCommand.cs +++ b/src/Cli/dotnet/Commands/Pack/PackCommand.cs @@ -60,6 +60,7 @@ public static CommandBase FromParseResult(ParseResult parseResult, string? msbui CommonOptions.RestorePropertiesOption, PackCommandParser.TargetOption, PackCommandParser.VerbosityOption, + PackCommandParser.NoLogoOption ], parseResult, msbuildPath, diff --git a/src/Cli/dotnet/Commands/Publish/PublishCommand.cs b/src/Cli/dotnet/Commands/Publish/PublishCommand.cs index 2bfb835871a9..424a2250c25a 100644 --- a/src/Cli/dotnet/Commands/Publish/PublishCommand.cs +++ b/src/Cli/dotnet/Commands/Publish/PublishCommand.cs @@ -58,7 +58,7 @@ public static CommandBase FromParseResult(ParseResult parseResult, string? msbui noRestore: noRestore, msbuildPath: msbuildPath ), - [CommonOptions.PropertiesOption, CommonOptions.RestorePropertiesOption, PublishCommandParser.TargetOption, PublishCommandParser.VerbosityOption], + [CommonOptions.PropertiesOption, CommonOptions.RestorePropertiesOption, PublishCommandParser.TargetOption, PublishCommandParser.VerbosityOption, PublishCommandParser.NoLogoOption], parseResult, msbuildPath, (msbuildArgs) => diff --git a/src/Cli/dotnet/Commands/Restore/RestoreCommand.cs b/src/Cli/dotnet/Commands/Restore/RestoreCommand.cs index 6eb650b0e261..5a9ff6a37056 100644 --- a/src/Cli/dotnet/Commands/Restore/RestoreCommand.cs +++ b/src/Cli/dotnet/Commands/Restore/RestoreCommand.cs @@ -40,7 +40,7 @@ public static CommandBase FromParseResult(ParseResult result, string? msbuildPat { return CreateForwarding(msbuildArgs, msbuildPath); }, - [CommonOptions.PropertiesOption, CommonOptions.RestorePropertiesOption, RestoreCommandParser.TargetOption, RestoreCommandParser.VerbosityOption], + [CommonOptions.PropertiesOption, CommonOptions.RestorePropertiesOption, RestoreCommandParser.TargetOption, RestoreCommandParser.VerbosityOption, RestoreCommandParser.NoLogoOption], result, msbuildPath ); diff --git a/src/Cli/dotnet/Commands/Restore/RestoreCommandParser.cs b/src/Cli/dotnet/Commands/Restore/RestoreCommandParser.cs index 7e1f4a48106d..981c4bf67fbd 100644 --- a/src/Cli/dotnet/Commands/Restore/RestoreCommandParser.cs +++ b/src/Cli/dotnet/Commands/Restore/RestoreCommandParser.cs @@ -27,6 +27,7 @@ internal static class RestoreCommandParser public static readonly Option TargetOption = CommonOptions.RequiredMSBuildTargetOption("Restore"); public static readonly Option VerbosityOption = CommonOptions.VerbosityOption(Utils.VerbosityOptions.minimal); + public static readonly Option NoLogoOption = CommonOptions.NoLogoOption(); private static IEnumerable