diff --git a/src/Build/BackEnd/Client/MSBuildClient.cs b/src/Build/BackEnd/Client/MSBuildClient.cs index fad0f82acea..273cfd69f84 100644 --- a/src/Build/BackEnd/Client/MSBuildClient.cs +++ b/src/Build/BackEnd/Client/MSBuildClient.cs @@ -11,6 +11,7 @@ using System.Threading; using Microsoft.Build.BackEnd; using Microsoft.Build.BackEnd.Client; +using Microsoft.Build.BackEnd.Logging; using Microsoft.Build.Eventing; using Microsoft.Build.Execution; using Microsoft.Build.Framework; @@ -78,6 +79,11 @@ public sealed class MSBuildClient private int _numConsoleWritePackets; private long _sizeOfConsoleWritePackets; + /// + /// Capture configuration of Client Console. + /// + private TargetConsoleConfiguration? _consoleConfiguration; + /// /// Public constructor with parameters. /// @@ -148,6 +154,8 @@ public MSBuildClientExitResult Execute(string commandLine, CancellationToken can return _exitResult; } + ConfigureAndQueryConsoleProperties(); + // Send build command. // Let's send it outside the packet pump so that we easier and quicker deal with possible issues with connection to server. MSBuildEventSource.Log.MSBuildServerBuildStart(commandLine); @@ -177,11 +185,6 @@ public MSBuildClientExitResult Execute(string commandLine, CancellationToken can packetPump.PacketReceivedEvent }; - if (NativeMethodsShared.IsWindows) - { - SupportVT100(); - } - while (!_buildFinished) { int index = WaitHandle.WaitAny(waitHandles); @@ -223,14 +226,100 @@ public MSBuildClientExitResult Execute(string commandLine, CancellationToken can return _exitResult; } - private void SupportVT100() + private void ConfigureAndQueryConsoleProperties() + { + var (acceptAnsiColorCodes, outputIsScreen) = QueryIsScreenAndTryEnableAnsiColorCodes(); + int bufferWidth = QueryConsoleBufferWidth(); + ConsoleColor backgroundColor = QueryConsoleBackgroundColor(); + + _consoleConfiguration = new TargetConsoleConfiguration(bufferWidth, acceptAnsiColorCodes, outputIsScreen, backgroundColor); + } + + private (bool acceptAnsiColorCodes, bool outputIsScreen) QueryIsScreenAndTryEnableAnsiColorCodes() + { + bool acceptAnsiColorCodes = false; + bool outputIsScreen = false; + + if (NativeMethodsShared.IsWindows) + { + try + { + IntPtr stdOut = NativeMethodsShared.GetStdHandle(NativeMethodsShared.STD_OUTPUT_HANDLE); + if (NativeMethodsShared.GetConsoleMode(stdOut, out uint consoleMode)) + { + bool success; + if ((consoleMode & NativeMethodsShared.ENABLE_VIRTUAL_TERMINAL_PROCESSING) == NativeMethodsShared.ENABLE_VIRTUAL_TERMINAL_PROCESSING && + (consoleMode & NativeMethodsShared.DISABLE_NEWLINE_AUTO_RETURN) == NativeMethodsShared.DISABLE_NEWLINE_AUTO_RETURN) + { + // Console is already in required state + success = true; + } + else + { + consoleMode |= NativeMethodsShared.ENABLE_VIRTUAL_TERMINAL_PROCESSING | NativeMethodsShared.DISABLE_NEWLINE_AUTO_RETURN; + success = NativeMethodsShared.SetConsoleMode(stdOut, consoleMode); + } + + if (success) + { + acceptAnsiColorCodes = true; + } + + uint fileType = NativeMethodsShared.GetFileType(stdOut); + // The std out is a char type(LPT or Console) + outputIsScreen = fileType == NativeMethodsShared.FILE_TYPE_CHAR; + acceptAnsiColorCodes &= outputIsScreen; + } + } + catch (Exception ex) + { + CommunicationsUtilities.Trace("MSBuild client warning: problem during enabling support for VT100: {0}.", ex); + } + } + else + { + // On posix OSes we expect console always supports VT100 coloring unless it is redirected + acceptAnsiColorCodes = outputIsScreen = !Console.IsOutputRedirected; + } + + return (acceptAnsiColorCodes: acceptAnsiColorCodes, outputIsScreen: outputIsScreen); + } + + private int QueryConsoleBufferWidth() { - IntPtr stdOut = NativeMethodsShared.GetStdHandle(NativeMethodsShared.STD_OUTPUT_HANDLE); - if (NativeMethodsShared.GetConsoleMode(stdOut, out uint consoleMode)) + int consoleBufferWidth = -1; + try { - consoleMode |= NativeMethodsShared.ENABLE_VIRTUAL_TERMINAL_PROCESSING | NativeMethodsShared.DISABLE_NEWLINE_AUTO_RETURN; - NativeMethodsShared.SetConsoleMode(stdOut, consoleMode); + consoleBufferWidth = Console.BufferWidth; } + catch (Exception ex) + { + // on Win8 machines while in IDE Console.BufferWidth will throw (while it talks to native console it gets "operation aborted" native error) + // this is probably temporary workaround till we understand what is the reason for that exception + CommunicationsUtilities.Trace("MSBuild client warning: problem during querying console buffer width.", ex); + } + + return consoleBufferWidth; + } + + /// + /// Some platforms do not allow getting current background color. There + /// is not way to check, but not-supported exception is thrown. Assume + /// black, but don't crash. + /// + private ConsoleColor QueryConsoleBackgroundColor() + { + ConsoleColor consoleBackgroundColor; + try + { + consoleBackgroundColor = Console.BackgroundColor; + } + catch (PlatformNotSupportedException) + { + consoleBackgroundColor = ConsoleColor.Black; + } + + return consoleBackgroundColor; } private bool TrySendPacket(Func packetResolver) @@ -324,7 +413,8 @@ private ServerNodeBuildCommand GetServerNodeBuildCommand(string commandLine) startupDirectory: Directory.GetCurrentDirectory(), buildProcessEnvironment: envVars, CultureInfo.CurrentCulture, - CultureInfo.CurrentUICulture); + CultureInfo.CurrentUICulture, + _consoleConfiguration!); } private ServerNodeHandshake GetHandshake() diff --git a/src/Build/BackEnd/Node/OutOfProcServerNode.cs b/src/Build/BackEnd/Node/OutOfProcServerNode.cs index 531ece6f3f1..0053b91705b 100644 --- a/src/Build/BackEnd/Node/OutOfProcServerNode.cs +++ b/src/Build/BackEnd/Node/OutOfProcServerNode.cs @@ -11,6 +11,7 @@ using Microsoft.Build.Internal; using System.Threading.Tasks; using Microsoft.Build.Execution; +using Microsoft.Build.BackEnd.Logging; namespace Microsoft.Build.Experimental { @@ -312,13 +313,34 @@ private void HandleServerNodeBuildCommand(ServerNodeBuildCommand command) return; } - // set build process context + // Set build process context Directory.SetCurrentDirectory(command.StartupDirectory); CommunicationsUtilities.SetEnvironment(command.BuildProcessEnvironment); Thread.CurrentThread.CurrentCulture = command.Culture; Thread.CurrentThread.CurrentUICulture = command.UICulture; - // configure console output redirection + // Configure console configuration so Loggers can change their behavior based on Target (client) Console properties. + ConsoleConfiguration.Provider = command.ConsoleConfiguration; + + // Also try our best to increase chance custom Loggers which use Console static members will work as expected. + try + { + if (NativeMethodsShared.IsWindows && command.ConsoleConfiguration.BufferWidth > 0) + { + Console.BufferWidth = command.ConsoleConfiguration.BufferWidth; + } + + if ((int)command.ConsoleConfiguration.BackgroundColor != -1) + { + Console.BackgroundColor = command.ConsoleConfiguration.BackgroundColor; + } + } + catch (Exception) + { + // Ignore exception, it is best effort only + } + + // Configure console output redirection var oldOut = Console.Out; var oldErr = Console.Error; (int exitCode, string exitType) buildResult; diff --git a/src/Build/BackEnd/Node/ServerNodeBuildCommand.cs b/src/Build/BackEnd/Node/ServerNodeBuildCommand.cs index 48ab050cf1e..a83adf83e8c 100644 --- a/src/Build/BackEnd/Node/ServerNodeBuildCommand.cs +++ b/src/Build/BackEnd/Node/ServerNodeBuildCommand.cs @@ -1,10 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -// using System; using System.Collections.Generic; using System.Globalization; +using Microsoft.Build.BackEnd.Logging; +using Microsoft.Build.Shared; namespace Microsoft.Build.BackEnd { @@ -18,6 +19,7 @@ internal sealed class ServerNodeBuildCommand : INodePacket private Dictionary _buildProcessEnvironment = default!; private CultureInfo _culture = default!; private CultureInfo _uiCulture = default!; + private TargetConsoleConfiguration _consoleConfiguration = default!; /// /// Retrieves the packet type. @@ -49,6 +51,11 @@ internal sealed class ServerNodeBuildCommand : INodePacket /// public CultureInfo UICulture => _uiCulture; + /// + /// Console configuration of Client. + /// + public TargetConsoleConfiguration ConsoleConfiguration => _consoleConfiguration; + /// /// Private constructor for deserialization /// @@ -56,13 +63,17 @@ private ServerNodeBuildCommand() { } - public ServerNodeBuildCommand(string commandLine, string startupDirectory, Dictionary buildProcessEnvironment, CultureInfo culture, CultureInfo uiCulture) + public ServerNodeBuildCommand(string commandLine, string startupDirectory, Dictionary buildProcessEnvironment, CultureInfo culture, CultureInfo uiCulture, + TargetConsoleConfiguration consoleConfiguration) { + ErrorUtilities.VerifyThrowInternalNull(consoleConfiguration, nameof(consoleConfiguration)); + _commandLine = commandLine; _startupDirectory = startupDirectory; _buildProcessEnvironment = buildProcessEnvironment; _culture = culture; _uiCulture = uiCulture; + _consoleConfiguration = consoleConfiguration; } /// @@ -76,6 +87,7 @@ public void Translate(ITranslator translator) translator.TranslateDictionary(ref _buildProcessEnvironment, StringComparer.OrdinalIgnoreCase); translator.TranslateCulture(ref _culture); translator.TranslateCulture(ref _uiCulture); + translator.Translate(ref _consoleConfiguration, TargetConsoleConfiguration.FactoryForDeserialization); } /// diff --git a/src/Build/Logging/BaseConsoleLogger.cs b/src/Build/Logging/BaseConsoleLogger.cs index ea87f587b70..20bd109a974 100644 --- a/src/Build/Logging/BaseConsoleLogger.cs +++ b/src/Build/Logging/BaseConsoleLogger.cs @@ -4,6 +4,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; @@ -28,38 +29,8 @@ namespace Microsoft.Build.BackEnd.Logging internal abstract class BaseConsoleLogger : INodeLogger { - /// - /// When set, we'll try reading background color. - /// - private static bool _supportReadingBackgroundColor = true; - #region Properties - /// - /// Some platforms do not allow getting current background color. There - /// is not way to check, but not-supported exception is thrown. Assume - /// black, but don't crash. - /// - internal static ConsoleColor BackgroundColor - { - get - { - if (_supportReadingBackgroundColor) - { - try - { - return Console.BackgroundColor; - } - catch (PlatformNotSupportedException) - { - _supportReadingBackgroundColor = false; - } - } - - return ConsoleColor.Black; - } - } - /// /// Gets or sets the level of detail to show in the event log. /// @@ -314,16 +285,7 @@ internal void IsRunningWithCharacterFileType() if (NativeMethodsShared.IsWindows) { - // Get the std out handle - IntPtr stdHandle = NativeMethodsShared.GetStdHandle(NativeMethodsShared.STD_OUTPUT_HANDLE); - - if (stdHandle != NativeMethods.InvalidHandle) - { - uint fileType = NativeMethodsShared.GetFileType(stdHandle); - - // The std out is a char type(LPT or Console) - runningWithCharacterFileType = (fileType == NativeMethodsShared.FILE_TYPE_CHAR); - } + runningWithCharacterFileType = ConsoleConfiguration.OutputIsScreen; } } @@ -367,7 +329,7 @@ internal static void SetColor(ConsoleColor c) { try { - Console.ForegroundColor = TransformColor(c, BackgroundColor); + Console.ForegroundColor = TransformColor(c, ConsoleConfiguration.BackgroundColor); } catch (IOException) { @@ -480,7 +442,7 @@ internal void InitializeConsoleMethods(LoggerVerbosity logverbosity, WriteHandle try { - ConsoleColor c = BackgroundColor; + ConsoleColor c = ConsoleConfiguration.BackgroundColor; } catch (IOException) { @@ -1278,4 +1240,234 @@ private bool ApplyVerbosityParameter(string parameterValue) #endregion } + + /// + /// Console configuration needed for proper Console logging. + /// + internal interface IConsoleConfiguration + { + /// + /// Buffer width of destination Console. + /// Console loggers are supposed, on Windows OS, to be wrapping to avoid output trimming. + /// -1 console buffer width can't be obtained. + /// + int BufferWidth { get; } + + /// + /// True if console output accept ANSI colors codes. + /// False if output is redirected to non screen type such as file or nul. + /// + bool AcceptAnsiColorCodes { get; } + + /// + /// True if console output is screen. It is expected that non screen output is post-processed and often does not need wrapping and coloring. + /// False if output is redirected to non screen type such as file or nul. + /// + bool OutputIsScreen { get; } + + /// + /// Background color of client console, -1 if not detectable + /// Some platforms do not allow getting current background color. There + /// is not way to check, but not-supported exception is thrown. Assume + /// black, but don't crash. + /// + ConsoleColor BackgroundColor { get; } + } + + /// + /// Console configuration of target Console at which we will render output. + /// It is supposed to be Console from other process to which output from this process will be redirected. + /// + internal class TargetConsoleConfiguration : IConsoleConfiguration, ITranslatable + { + private int _bufferWidth; + private bool _acceptAnsiColorCodes; + private bool _outputIsScreen; + private ConsoleColor _backgroundColor; + + public TargetConsoleConfiguration(int bufferWidth, bool acceptAnsiColorCodes, bool outputIsScreen, ConsoleColor backgroundColor) + { + _bufferWidth = bufferWidth; + _acceptAnsiColorCodes = acceptAnsiColorCodes; + _outputIsScreen = outputIsScreen; + _backgroundColor = backgroundColor; + } + + /// + /// Constructor for deserialization + /// + private TargetConsoleConfiguration() + { + } + + public int BufferWidth => _bufferWidth; + + public bool AcceptAnsiColorCodes => _acceptAnsiColorCodes; + + public bool OutputIsScreen => _outputIsScreen; + + public ConsoleColor BackgroundColor => _backgroundColor; + + public void Translate(ITranslator translator) + { + translator.Translate(ref _bufferWidth); + translator.Translate(ref _acceptAnsiColorCodes); + translator.Translate(ref _outputIsScreen); + translator.TranslateEnum(ref _backgroundColor, (int)_backgroundColor); + } + + internal static TargetConsoleConfiguration FactoryForDeserialization(ITranslator translator) + { + TargetConsoleConfiguration configuration = new(); + configuration.Translate(translator); + return configuration; + } + } + + /// + /// Console configuration of current process Console. + /// + internal class InProcessConsoleConfiguration : IConsoleConfiguration + { + /// + /// When set, we'll try reading background color. + /// + private static bool s_supportReadingBackgroundColor = true; + + public int BufferWidth => Console.BufferWidth; + + public bool AcceptAnsiColorCodes + { + get + { + bool acceptAnsiColorCodes = false; + if (NativeMethodsShared.IsWindows && !Console.IsOutputRedirected) + { + try + { + IntPtr stdOut = NativeMethodsShared.GetStdHandle(NativeMethodsShared.STD_OUTPUT_HANDLE); + if (NativeMethodsShared.GetConsoleMode(stdOut, out uint consoleMode)) + { + acceptAnsiColorCodes = (consoleMode & NativeMethodsShared.ENABLE_VIRTUAL_TERMINAL_PROCESSING) != 0; + } + } + catch (Exception ex) + { + Debug.Assert(false, $"MSBuild client warning: problem during enabling support for VT100: {ex}."); + } + } + else + { + // On posix OSes we expect console always supports VT100 coloring unless it is redirected + acceptAnsiColorCodes = !Console.IsOutputRedirected; + } + + return acceptAnsiColorCodes; + } + } + + public ConsoleColor BackgroundColor + { + get + { + if (s_supportReadingBackgroundColor) + { + try + { + return Console.BackgroundColor; + } + catch (PlatformNotSupportedException) + { + s_supportReadingBackgroundColor = false; + } + } + + return ConsoleColor.Black; + } + } + + public bool OutputIsScreen + { + get + { + bool isScreen = false; + + if (NativeMethodsShared.IsWindows) + { + // Get the std out handle + IntPtr stdHandle = NativeMethodsShared.GetStdHandle(NativeMethodsShared.STD_OUTPUT_HANDLE); + + if (stdHandle != NativeMethods.InvalidHandle) + { + uint fileType = NativeMethodsShared.GetFileType(stdHandle); + + // The std out is a char type(LPT or Console) + isScreen = fileType == NativeMethodsShared.FILE_TYPE_CHAR; + } + } + else + { + isScreen = !Console.IsOutputRedirected; + } + + return isScreen; + } + } + } + + /// + /// Target console configuration. + /// If console output is redirected to other process console, like for example MSBuild Server does, + /// we need to know property of target/final console at which our output will be rendered. + /// If console is rendered at current process Console, we grab properties from Console and/or by WinAPI. + /// + internal static class ConsoleConfiguration + { + /// + /// Get or set current target console configuration provider. + /// + public static IConsoleConfiguration Provider + { + get { return Instance.s_instance; } + set { Instance.s_instance = value; } + } + + private static class Instance + { + // Explicit static constructor to tell C# compiler + // not to mark type as beforefieldinit + static Instance() + { + } + + internal static IConsoleConfiguration s_instance = new InProcessConsoleConfiguration(); + } + + /// + /// Buffer width of destination Console. + /// Console loggers are supposed, on Windows OS, to be wrapping to avoid output trimming. + /// -1 console buffer width can't be obtained. + /// + public static int BufferWidth => Provider.BufferWidth; + + /// + /// True if console output accept ANSI colors codes. + /// False if output is redirected to non screen type such as file or nul. + /// + public static bool AcceptAnsiColorCodes => Provider.AcceptAnsiColorCodes; + + /// + /// Background color of client console, -1 if not detectable + /// Some platforms do not allow getting current background color. There + /// is not way to check, but not-supported exception is thrown. Assume + /// black, but don't crash. + /// + public static ConsoleColor BackgroundColor => Provider.BackgroundColor; + + /// + /// True if console output is screen. It is expected that non screen output is post-processed and often does not need wrapping and coloring. + /// False if output is redirected to non screen type such as file or nul. + /// + public static bool OutputIsScreen => Provider.OutputIsScreen; + } } diff --git a/src/Build/Logging/ConsoleLogger.cs b/src/Build/Logging/ConsoleLogger.cs index 543667811bf..d4320ced186 100644 --- a/src/Build/Logging/ConsoleLogger.cs +++ b/src/Build/Logging/ConsoleLogger.cs @@ -3,6 +3,7 @@ using System; +using Microsoft.Build.BackEnd.Logging; using Microsoft.Build.Framework; using Microsoft.Build.Shared; @@ -109,6 +110,7 @@ private void InitializeBaseConsoleLogger() bool useMPLogger = false; bool disableConsoleColor = false; bool forceConsoleColor = false; + bool preferConsoleColor = false; if (!string.IsNullOrEmpty(_parameters)) { string[] parameterComponents = _parameters.Split(BaseConsoleLogger.parameterDelimiters); @@ -132,10 +134,15 @@ private void InitializeBaseConsoleLogger() { forceConsoleColor = true; } + if (string.Equals(param, "PREFERCONSOLECOLOR", StringComparison.OrdinalIgnoreCase)) + { + // Use ansi color codes if current target console do support it + preferConsoleColor = ConsoleConfiguration.AcceptAnsiColorCodes; + } } } - if (forceConsoleColor) + if (forceConsoleColor || (!disableConsoleColor && preferConsoleColor)) { _colorSet = BaseConsoleLogger.SetColorAnsi; _colorReset = BaseConsoleLogger.ResetColorAnsi; diff --git a/src/Build/Logging/ParallelLogger/ParallelConsoleLogger.cs b/src/Build/Logging/ParallelLogger/ParallelConsoleLogger.cs index b0d0c7eb7b3..fe63ce04137 100644 --- a/src/Build/Logging/ParallelLogger/ParallelConsoleLogger.cs +++ b/src/Build/Logging/ParallelLogger/ParallelConsoleLogger.cs @@ -88,7 +88,7 @@ private void CheckIfOutputSupportsAlignment() // Get the size of the console buffer so messages can be formatted to the console width try { - _bufferWidth = Console.BufferWidth; + _bufferWidth = ConsoleConfiguration.BufferWidth; _alignMessages = true; } catch (Exception) diff --git a/src/Framework/NativeMethods.cs b/src/Framework/NativeMethods.cs index 5b990331277..2f928186628 100644 --- a/src/Framework/NativeMethods.cs +++ b/src/Framework/NativeMethods.cs @@ -60,6 +60,7 @@ internal static class NativeMethods internal static HandleRef NullHandleRef = new HandleRef(null, IntPtr.Zero); internal static IntPtr NullIntPtr = new IntPtr(0); + internal static IntPtr InvalidHandle = new IntPtr(-1); // As defined in winnt.h: internal const ushort PROCESSOR_ARCHITECTURE_INTEL = 0; diff --git a/src/MSBuild/Resources/Strings.resx b/src/MSBuild/Resources/Strings.resx index c69053daa0c..c33245ceae6 100644 --- a/src/MSBuild/Resources/Strings.resx +++ b/src/MSBuild/Resources/Strings.resx @@ -319,7 +319,9 @@ Copyright (C) Microsoft Corporation. All rights reserved. mode. This logging style is on by default. ForceConsoleColor--Use ANSI console colors even if console does not support it - Verbosity--overrides the -verbosity setting for this + PreferConsoleColor--Use ANSI console colors only if + target console does support it + Verbosity--overrides the -verbosity setting for this logger. Example: -consoleLoggerParameters:PerformanceSummary;NoSummary; diff --git a/src/MSBuild/Resources/xlf/Strings.cs.xlf b/src/MSBuild/Resources/xlf/Strings.cs.xlf index 7ccdc9ab43e..677d56274cc 100644 --- a/src/MSBuild/Resources/xlf/Strings.cs.xlf +++ b/src/MSBuild/Resources/xlf/Strings.cs.xlf @@ -512,13 +512,15 @@ Copyright (C) Microsoft Corporation. Všechna práva vyhrazena. mode. This logging style is on by default. ForceConsoleColor--Use ANSI console colors even if console does not support it - Verbosity--overrides the -verbosity setting for this + PreferConsoleColor--Use ANSI console colors only if + target console does support it + Verbosity--overrides the -verbosity setting for this logger. Example: -consoleLoggerParameters:PerformanceSummary;NoSummary; Verbosity=minimal - -consoleloggerparameters:<parameters> + -consoleloggerparameters:<parameters> Parametry protokolovacího nástroje konzoly. (Krátký tvar: -clp) Dostupné parametry: PerformanceSummary – zobrazí dobu zpracování úloh, cílů diff --git a/src/MSBuild/Resources/xlf/Strings.de.xlf b/src/MSBuild/Resources/xlf/Strings.de.xlf index e2c30e3ac4f..12af6eb477d 100644 --- a/src/MSBuild/Resources/xlf/Strings.de.xlf +++ b/src/MSBuild/Resources/xlf/Strings.de.xlf @@ -509,13 +509,15 @@ Beispiel: mode. This logging style is on by default. ForceConsoleColor--Use ANSI console colors even if console does not support it - Verbosity--overrides the -verbosity setting for this + PreferConsoleColor--Use ANSI console colors only if + target console does support it + Verbosity--overrides the -verbosity setting for this logger. Example: -consoleLoggerParameters:PerformanceSummary;NoSummary; Verbosity=minimal - -consoleloggerparameters:<Parameter> + -consoleloggerparameters:<Parameter> Parameter für die Konsolenprotokollierung. (Kurzform: -clp) Folgende Parameter sind verfügbar: PerformanceSummary: Zeigt die in Aufgaben, Zielen und diff --git a/src/MSBuild/Resources/xlf/Strings.es.xlf b/src/MSBuild/Resources/xlf/Strings.es.xlf index 0195e35549f..d089c52d291 100644 --- a/src/MSBuild/Resources/xlf/Strings.es.xlf +++ b/src/MSBuild/Resources/xlf/Strings.es.xlf @@ -513,13 +513,15 @@ Copyright (C) Microsoft Corporation. Todos los derechos reservados. mode. This logging style is on by default. ForceConsoleColor--Use ANSI console colors even if console does not support it - Verbosity--overrides the -verbosity setting for this + PreferConsoleColor--Use ANSI console colors only if + target console does support it + Verbosity--overrides the -verbosity setting for this logger. Example: -consoleLoggerParameters:PerformanceSummary;NoSummary; Verbosity=minimal - -consoleLoggerParameters:<parámetros> + -consoleLoggerParameters:<parámetros> Parámetros del registrador de consola. (Forma corta: -clp) Los parámetros disponibles son: PerformanceSummary: muestra el tiempo empleado en tareas, destinos diff --git a/src/MSBuild/Resources/xlf/Strings.fr.xlf b/src/MSBuild/Resources/xlf/Strings.fr.xlf index 3065aadd997..b42e8b553ec 100644 --- a/src/MSBuild/Resources/xlf/Strings.fr.xlf +++ b/src/MSBuild/Resources/xlf/Strings.fr.xlf @@ -509,13 +509,15 @@ Copyright (C) Microsoft Corporation. Tous droits réservés. mode. This logging style is on by default. ForceConsoleColor--Use ANSI console colors even if console does not support it - Verbosity--overrides the -verbosity setting for this + PreferConsoleColor--Use ANSI console colors only if + target console does support it + Verbosity--overrides the -verbosity setting for this logger. Example: -consoleLoggerParameters:PerformanceSummary;NoSummary; Verbosity=minimal - -consoleLoggerParameters:<paramètres> + -consoleLoggerParameters:<paramètres> Paramètres du journaliseur de la console. (Forme abrégée : -clp) Paramètres disponibles : PerformanceSummary--Affiche la durée des tâches, des cibles diff --git a/src/MSBuild/Resources/xlf/Strings.it.xlf b/src/MSBuild/Resources/xlf/Strings.it.xlf index 9c59271398b..80ecce717c9 100644 --- a/src/MSBuild/Resources/xlf/Strings.it.xlf +++ b/src/MSBuild/Resources/xlf/Strings.it.xlf @@ -519,13 +519,15 @@ Esempio: mode. This logging style is on by default. ForceConsoleColor--Use ANSI console colors even if console does not support it - Verbosity--overrides the -verbosity setting for this + PreferConsoleColor--Use ANSI console colors only if + target console does support it + Verbosity--overrides the -verbosity setting for this logger. Example: -consoleLoggerParameters:PerformanceSummary;NoSummary; Verbosity=minimal - -consoleLoggerParameters:<parametri> + -consoleLoggerParameters:<parametri> Parametri per il logger di console. Forma breve: -clp. I parametri disponibili sono: PerformanceSummary: indica il tempo impiegato per le diff --git a/src/MSBuild/Resources/xlf/Strings.ja.xlf b/src/MSBuild/Resources/xlf/Strings.ja.xlf index 9c2bee6bc61..75e8bb75f83 100644 --- a/src/MSBuild/Resources/xlf/Strings.ja.xlf +++ b/src/MSBuild/Resources/xlf/Strings.ja.xlf @@ -509,13 +509,15 @@ Copyright (C) Microsoft Corporation.All rights reserved. mode. This logging style is on by default. ForceConsoleColor--Use ANSI console colors even if console does not support it - Verbosity--overrides the -verbosity setting for this + PreferConsoleColor--Use ANSI console colors only if + target console does support it + Verbosity--overrides the -verbosity setting for this logger. Example: -consoleLoggerParameters:PerformanceSummary;NoSummary; Verbosity=minimal - -consoleLoggerParameters:<parameters> + -consoleLoggerParameters:<parameters> コンソール ロガーへのパラメーターです。(短縮形: -clp) 利用可能なパラメーター: PerformanceSummary--タスク、ターゲット、プロジェクトにかかった時間を diff --git a/src/MSBuild/Resources/xlf/Strings.ko.xlf b/src/MSBuild/Resources/xlf/Strings.ko.xlf index 3d3b611cc74..b2cbad8117d 100644 --- a/src/MSBuild/Resources/xlf/Strings.ko.xlf +++ b/src/MSBuild/Resources/xlf/Strings.ko.xlf @@ -509,13 +509,15 @@ Copyright (C) Microsoft Corporation. All rights reserved. mode. This logging style is on by default. ForceConsoleColor--Use ANSI console colors even if console does not support it - Verbosity--overrides the -verbosity setting for this + PreferConsoleColor--Use ANSI console colors only if + target console does support it + Verbosity--overrides the -verbosity setting for this logger. Example: -consoleLoggerParameters:PerformanceSummary;NoSummary; Verbosity=minimal - -consoleLoggerParameters:<parameters> + -consoleLoggerParameters:<parameters> 콘솔 로거에 대한 매개 변수입니다. (약식: -clp) 사용 가능한 매개 변수는 다음과 같습니다. PerformanceSummary--작업, 대상 및 프로젝트에서 소요된 시간을 diff --git a/src/MSBuild/Resources/xlf/Strings.pl.xlf b/src/MSBuild/Resources/xlf/Strings.pl.xlf index 2c2f7464b68..e7dec45a8d7 100644 --- a/src/MSBuild/Resources/xlf/Strings.pl.xlf +++ b/src/MSBuild/Resources/xlf/Strings.pl.xlf @@ -519,13 +519,15 @@ Copyright (C) Microsoft Corporation. Wszelkie prawa zastrzeżone. mode. This logging style is on by default. ForceConsoleColor--Use ANSI console colors even if console does not support it - Verbosity--overrides the -verbosity setting for this + PreferConsoleColor--Use ANSI console colors only if + target console does support it + Verbosity--overrides the -verbosity setting for this logger. Example: -consoleLoggerParameters:PerformanceSummary;NoSummary; Verbosity=minimal - -consoleLoggerParameters:<parametry> + -consoleLoggerParameters:<parametry> Parametry rejestratora konsoli. (Krótka wersja: -clp) Dostępne parametry: PerformanceSummary — pokazuje czas spędzony diff --git a/src/MSBuild/Resources/xlf/Strings.pt-BR.xlf b/src/MSBuild/Resources/xlf/Strings.pt-BR.xlf index 6dc052fc5bd..80b55165e6b 100644 --- a/src/MSBuild/Resources/xlf/Strings.pt-BR.xlf +++ b/src/MSBuild/Resources/xlf/Strings.pt-BR.xlf @@ -510,13 +510,15 @@ isoladamente. mode. This logging style is on by default. ForceConsoleColor--Use ANSI console colors even if console does not support it - Verbosity--overrides the -verbosity setting for this + PreferConsoleColor--Use ANSI console colors only if + target console does support it + Verbosity--overrides the -verbosity setting for this logger. Example: -consoleLoggerParameters:PerformanceSummary;NoSummary; Verbosity=minimal - -consoleLoggerParameters:<parameters> + -consoleLoggerParameters:<parameters> Parâmetros do agente do console. (Forma abreviada: -clp) Os parâmetros disponíveis são: PerformanceSummary – mostrar o tempo gasto nas tarefas, nos destinos diff --git a/src/MSBuild/Resources/xlf/Strings.ru.xlf b/src/MSBuild/Resources/xlf/Strings.ru.xlf index b39acf70142..d59d0abd1c4 100644 --- a/src/MSBuild/Resources/xlf/Strings.ru.xlf +++ b/src/MSBuild/Resources/xlf/Strings.ru.xlf @@ -508,13 +508,15 @@ Copyright (C) Microsoft Corporation. All rights reserved. mode. This logging style is on by default. ForceConsoleColor--Use ANSI console colors even if console does not support it - Verbosity--overrides the -verbosity setting for this + PreferConsoleColor--Use ANSI console colors only if + target console does support it + Verbosity--overrides the -verbosity setting for this logger. Example: -consoleLoggerParameters:PerformanceSummary;NoSummary; Verbosity=minimal - -consoleLoggerParameters:<параметры> + -consoleLoggerParameters:<параметры> Параметры журнала консоли. (Краткая форма: -clp) Доступны следующие параметры: PerformanceSummary--выводить время, затраченное на выполнение задач, diff --git a/src/MSBuild/Resources/xlf/Strings.tr.xlf b/src/MSBuild/Resources/xlf/Strings.tr.xlf index eb65858ec3a..266cc59600b 100644 --- a/src/MSBuild/Resources/xlf/Strings.tr.xlf +++ b/src/MSBuild/Resources/xlf/Strings.tr.xlf @@ -509,13 +509,15 @@ Telif Hakkı (C) Microsoft Corporation. Tüm hakları saklıdır. mode. This logging style is on by default. ForceConsoleColor--Use ANSI console colors even if console does not support it - Verbosity--overrides the -verbosity setting for this + PreferConsoleColor--Use ANSI console colors only if + target console does support it + Verbosity--overrides the -verbosity setting for this logger. Example: -consoleLoggerParameters:PerformanceSummary;NoSummary; Verbosity=minimal - -consoleLoggerParameters:<parametreler> + -consoleLoggerParameters:<parametreler> Konsol günlükçüsü için parametreler. (Kısa biçim: -clp) Kullanılabilir parametreler: PerformanceSummary--Görevlerde, hedeflerde ve diff --git a/src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf b/src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf index a4fc1ecdd32..ccd7c4c9392 100644 --- a/src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf @@ -509,13 +509,15 @@ Copyright (C) Microsoft Corporation. All rights reserved. mode. This logging style is on by default. ForceConsoleColor--Use ANSI console colors even if console does not support it - Verbosity--overrides the -verbosity setting for this + PreferConsoleColor--Use ANSI console colors only if + target console does support it + Verbosity--overrides the -verbosity setting for this logger. Example: -consoleLoggerParameters:PerformanceSummary;NoSummary; Verbosity=minimal - -consoleloggerparameters:<parameters> + -consoleloggerparameters:<parameters> 控制台记录器的参数。(缩写: -clp) 可用参数包括: PerformanceSummary -- 显示在任务、目标和项目上 diff --git a/src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf b/src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf index 2dc040b10b9..f6306ec8319 100644 --- a/src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf @@ -509,13 +509,15 @@ Copyright (C) Microsoft Corporation. 著作權所有,並保留一切權利。 mode. This logging style is on by default. ForceConsoleColor--Use ANSI console colors even if console does not support it - Verbosity--overrides the -verbosity setting for this + PreferConsoleColor--Use ANSI console colors only if + target console does support it + Verbosity--overrides the -verbosity setting for this logger. Example: -consoleLoggerParameters:PerformanceSummary;NoSummary; Verbosity=minimal - -consoleLoggerParameters:<參數> + -consoleLoggerParameters:<參數> 主控台記錄器的參數。(簡短形式: -clp) 可用的參數為: PerformanceSummary--顯示工作、目標 diff --git a/src/MSBuild/XMake.cs b/src/MSBuild/XMake.cs index ebe6acb78af..373e4a58aa3 100644 --- a/src/MSBuild/XMake.cs +++ b/src/MSBuild/XMake.cs @@ -3215,7 +3215,7 @@ List loggers // Always use ANSI escape codes when the build is initiated by server if (s_isServerNode) { - consoleParameters = AggregateParameters(consoleParameters, new[] { "FORCECONSOLECOLOR" }); + consoleParameters = $"PREFERCONSOLECOLOR;{consoleParameters}"; } // Check to see if there is a possibility we will be logging from an out-of-proc node.