diff --git a/src/Build/BackEnd/BuildManager/BuildManager.cs b/src/Build/BackEnd/BuildManager/BuildManager.cs
index 9253bce109b..02b2799a972 100644
--- a/src/Build/BackEnd/BuildManager/BuildManager.cs
+++ b/src/Build/BackEnd/BuildManager/BuildManager.cs
@@ -396,6 +396,16 @@ public static BuildManager DefaultBuildManager
///
LegacyThreadingData IBuildComponentHost.LegacyThreadingData => _legacyThreadingData;
+ ///
+ /// Enumeration describing the severity of a deferred build message.
+ ///
+ public enum DeferredBuildMessageSeverity
+ {
+ Message = 1,
+ Warning,
+ Error
+ }
+
///
///
///
@@ -407,11 +417,19 @@ public readonly struct DeferredBuildMessage
public string? FilePath { get; }
+ public DeferredBuildMessageSeverity MessageSeverity { get; } = DeferredBuildMessageSeverity.Message;
+
+ ///
+ /// Build event code (e.g., "MSB1070").
+ ///
+ public string? Code { get; }
+
public DeferredBuildMessage(string text, MessageImportance importance)
{
Importance = importance;
Text = text;
FilePath = null;
+ Code = null;
}
public DeferredBuildMessage(string text, MessageImportance importance, string filePath)
@@ -419,6 +437,22 @@ public DeferredBuildMessage(string text, MessageImportance importance, string fi
Importance = importance;
Text = text;
FilePath = filePath;
+ Code = null;
+ }
+
+ ///
+ /// Creates a deferred warning message.
+ ///
+ /// The warning message text.
+ /// The build message code (e.g., "MSB1070").
+ /// The severity of the deferred build message.
+ public DeferredBuildMessage(string text, string code, DeferredBuildMessageSeverity messageSeverity)
+ {
+ Importance = MessageImportance.Normal;
+ Text = text;
+ FilePath = null;
+ Code = code;
+ MessageSeverity = messageSeverity;
}
}
@@ -3154,7 +3188,20 @@ private static void LogDeferredMessages(ILoggingService loggingService, IEnumera
foreach (var message in deferredBuildMessages)
{
- loggingService.LogCommentFromText(BuildEventContext.Invalid, message.Importance, message.Text);
+ if (message.MessageSeverity is DeferredBuildMessageSeverity.Warning)
+ {
+ loggingService.LogWarningFromText(
+ BuildEventContext.Invalid,
+ subcategoryResourceName: null,
+ warningCode: message.Code,
+ helpKeyword: null,
+ file: BuildEventFileInfo.Empty,
+ message: message.Text);
+ }
+ else
+ {
+ loggingService.LogCommentFromText(BuildEventContext.Invalid, message.Importance, message.Text);
+ }
// If message includes a file path, include that file
if (message.FilePath is not null)
diff --git a/src/Build/Resources/xlf/Strings.cs.xlf b/src/Build/Resources/xlf/Strings.cs.xlf
index 9ab02afe3bc..72d6d7fda24 100644
--- a/src/Build/Resources/xlf/Strings.cs.xlf
+++ b/src/Build/Resources/xlf/Strings.cs.xlf
@@ -491,7 +491,7 @@
MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}
- MSB4279: Nepodařilo se zkopírovat binární protokol z {0} do {1}. {2}
+ MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}{StrBegin="MSB4279: "}UE: This is shown when the Binary Logger fails to copy the log file to one of the specified output locations.
diff --git a/src/Build/Resources/xlf/Strings.de.xlf b/src/Build/Resources/xlf/Strings.de.xlf
index 5ce46079b62..2a77ed9ff61 100644
--- a/src/Build/Resources/xlf/Strings.de.xlf
+++ b/src/Build/Resources/xlf/Strings.de.xlf
@@ -491,7 +491,7 @@
MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}
- MSB4279: Fehler beim Kopieren des Binärprotokolls von „{0}“ nach „{1}“. {2}
+ MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}{StrBegin="MSB4279: "}UE: This is shown when the Binary Logger fails to copy the log file to one of the specified output locations.
diff --git a/src/Build/Resources/xlf/Strings.es.xlf b/src/Build/Resources/xlf/Strings.es.xlf
index a72490d50a5..eb658d3565f 100644
--- a/src/Build/Resources/xlf/Strings.es.xlf
+++ b/src/Build/Resources/xlf/Strings.es.xlf
@@ -491,7 +491,7 @@
MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}
- MSB4279: no se pudo copiar el registro binario de "{0}" a "{1}". {2}
+ MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}{StrBegin="MSB4279: "}UE: This is shown when the Binary Logger fails to copy the log file to one of the specified output locations.
diff --git a/src/Build/Resources/xlf/Strings.fr.xlf b/src/Build/Resources/xlf/Strings.fr.xlf
index 9264bfb3118..25e3980f51b 100644
--- a/src/Build/Resources/xlf/Strings.fr.xlf
+++ b/src/Build/Resources/xlf/Strings.fr.xlf
@@ -491,7 +491,7 @@
MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}
- MSB4279: Échec de la copie du journal binaire de « {0} » vers « {1} ». {2}
+ MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}{StrBegin="MSB4279: "}UE: This is shown when the Binary Logger fails to copy the log file to one of the specified output locations.
diff --git a/src/Build/Resources/xlf/Strings.it.xlf b/src/Build/Resources/xlf/Strings.it.xlf
index c3a339f9aba..239a9f429ce 100644
--- a/src/Build/Resources/xlf/Strings.it.xlf
+++ b/src/Build/Resources/xlf/Strings.it.xlf
@@ -491,7 +491,7 @@
MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}
- MSB4279: non è possibile copiare il log binario da "{0}" a "{1}". {2}
+ MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}{StrBegin="MSB4279: "}UE: This is shown when the Binary Logger fails to copy the log file to one of the specified output locations.
diff --git a/src/Build/Resources/xlf/Strings.ja.xlf b/src/Build/Resources/xlf/Strings.ja.xlf
index bab87c64b11..83ed22b46e0 100644
--- a/src/Build/Resources/xlf/Strings.ja.xlf
+++ b/src/Build/Resources/xlf/Strings.ja.xlf
@@ -491,7 +491,7 @@
MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}
- MSB4279: バイナリ ログを "{0}" から "{1}" にコピーできませんでした。{2}
+ MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}{StrBegin="MSB4279: "}UE: This is shown when the Binary Logger fails to copy the log file to one of the specified output locations.
diff --git a/src/Build/Resources/xlf/Strings.ko.xlf b/src/Build/Resources/xlf/Strings.ko.xlf
index 8fbaf0b2a79..fb99fabaddd 100644
--- a/src/Build/Resources/xlf/Strings.ko.xlf
+++ b/src/Build/Resources/xlf/Strings.ko.xlf
@@ -491,7 +491,7 @@
MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}
- MSB4279: 이진 로그를 "{0}"에서 "{1}"(으)로 복사하지 못했습니다. {2}
+ MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}{StrBegin="MSB4279: "}UE: This is shown when the Binary Logger fails to copy the log file to one of the specified output locations.
diff --git a/src/Build/Resources/xlf/Strings.pl.xlf b/src/Build/Resources/xlf/Strings.pl.xlf
index 5468c688eba..a30525b6f35 100644
--- a/src/Build/Resources/xlf/Strings.pl.xlf
+++ b/src/Build/Resources/xlf/Strings.pl.xlf
@@ -491,7 +491,7 @@
MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}
- MSB4279: nie można skopiować dziennika binarnego z „{0}” do „{1}”. {2}
+ MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}{StrBegin="MSB4279: "}UE: This is shown when the Binary Logger fails to copy the log file to one of the specified output locations.
diff --git a/src/Build/Resources/xlf/Strings.pt-BR.xlf b/src/Build/Resources/xlf/Strings.pt-BR.xlf
index f7957c45cda..dbbb7ef4630 100644
--- a/src/Build/Resources/xlf/Strings.pt-BR.xlf
+++ b/src/Build/Resources/xlf/Strings.pt-BR.xlf
@@ -491,7 +491,7 @@
MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}
- MSB4279: falha ao copiar o log binário de "{0}" para "{1}". {2}
+ MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}{StrBegin="MSB4279: "}UE: This is shown when the Binary Logger fails to copy the log file to one of the specified output locations.
diff --git a/src/Build/Resources/xlf/Strings.ru.xlf b/src/Build/Resources/xlf/Strings.ru.xlf
index 4b309e0cc21..73a9a7142b6 100644
--- a/src/Build/Resources/xlf/Strings.ru.xlf
+++ b/src/Build/Resources/xlf/Strings.ru.xlf
@@ -491,7 +491,7 @@
MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}
- MSB4279: не удалось скопировать двоичный журнал из "{0}" в "{1}". {2}
+ MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}{StrBegin="MSB4279: "}UE: This is shown when the Binary Logger fails to copy the log file to one of the specified output locations.
diff --git a/src/Build/Resources/xlf/Strings.tr.xlf b/src/Build/Resources/xlf/Strings.tr.xlf
index 87f9b73cded..9e8bfab9b40 100644
--- a/src/Build/Resources/xlf/Strings.tr.xlf
+++ b/src/Build/Resources/xlf/Strings.tr.xlf
@@ -491,7 +491,7 @@
MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}
- MSB4279: İkili günlük dosyası "{0}" konumundan "{1}" konumuna kopyalanamadı. {2}
+ MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}{StrBegin="MSB4279: "}UE: This is shown when the Binary Logger fails to copy the log file to one of the specified output locations.
diff --git a/src/Build/Resources/xlf/Strings.zh-Hans.xlf b/src/Build/Resources/xlf/Strings.zh-Hans.xlf
index ad7d1118c48..347c0136d86 100644
--- a/src/Build/Resources/xlf/Strings.zh-Hans.xlf
+++ b/src/Build/Resources/xlf/Strings.zh-Hans.xlf
@@ -491,7 +491,7 @@
MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}
- MSB4279: 未能将二进制日志从“{0}”复制到“{1}”。{2}
+ MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}{StrBegin="MSB4279: "}UE: This is shown when the Binary Logger fails to copy the log file to one of the specified output locations.
diff --git a/src/Build/Resources/xlf/Strings.zh-Hant.xlf b/src/Build/Resources/xlf/Strings.zh-Hant.xlf
index 6a78af31da7..3ccdd81d1c3 100644
--- a/src/Build/Resources/xlf/Strings.zh-Hant.xlf
+++ b/src/Build/Resources/xlf/Strings.zh-Hant.xlf
@@ -491,7 +491,7 @@
MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}
- MSB4279: 無法將二進位記錄從 "{0}" 複製到 "{1}"。{2}
+ MSB4279: Failed to copy binary log from "{0}" to "{1}". {2}{StrBegin="MSB4279: "}UE: This is shown when the Binary Logger fails to copy the log file to one of the specified output locations.
diff --git a/src/Framework/Traits.cs b/src/Framework/Traits.cs
index 31378398be6..f14208e145a 100644
--- a/src/Framework/Traits.cs
+++ b/src/Framework/Traits.cs
@@ -135,6 +135,28 @@ public Traits()
///
public const string UseMSBuildServerEnvVarName = "MSBUILDUSESERVER";
+ ///
+ /// Name of environment variable for logging arguments (e.g., -bl, -check).
+ ///
+ public const string MSBuildLoggingArgsEnvVarName = "MSBUILD_LOGGING_ARGS";
+
+ ///
+ /// Name of environment variable that controls the logging level for diagnostic messages
+ /// emitted when processing the MSBUILD_LOGGING_ARGS environment variable.
+ /// Set to "message" to emit as low-importance build messages instead of console warnings.
+ ///
+ public const string MSBuildLoggingArgsLevelEnvVarName = "MSBUILD_LOGGING_ARGS_LEVEL";
+
+ ///
+ /// Value of the MSBUILD_LOGGING_ARGS environment variable.
+ ///
+ public static string? MSBuildLoggingArgs => Environment.GetEnvironmentVariable(MSBuildLoggingArgsEnvVarName);
+
+ ///
+ /// Gets if the logging level for MSBUILD_LOGGING_ARGS diagnostic is message.
+ ///
+ public readonly bool EmitLogsAsMessage = string.Equals(Environment.GetEnvironmentVariable(MSBuildLoggingArgsLevelEnvVarName), "message", StringComparison.OrdinalIgnoreCase);
+
public readonly bool DebugEngine = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("MSBuildDebugEngine"));
public readonly bool DebugScheduler;
public readonly bool DebugNodeCommunication;
diff --git a/src/MSBuild.UnitTests/XMake_BinlogSwitch_Tests.cs b/src/MSBuild.UnitTests/XMake_BinlogSwitch_Tests.cs
new file mode 100644
index 00000000000..af764f80e36
--- /dev/null
+++ b/src/MSBuild.UnitTests/XMake_BinlogSwitch_Tests.cs
@@ -0,0 +1,294 @@
+// 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.IO;
+using Microsoft.Build.CommandLine.Experimental;
+using Microsoft.Build.Execution;
+using Microsoft.Build.UnitTests.Shared;
+using Shouldly;
+using Xunit;
+using Xunit.Abstractions;
+
+#nullable disable
+
+namespace Microsoft.Build.UnitTests
+{
+ ///
+ /// Tests for MSBUILD_LOGGING_ARGS environment variable functionality.
+ ///
+ public class XMakeBinlogSwitchTests : IDisposable
+ {
+ private readonly ITestOutputHelper _output;
+ private readonly TestEnvironment _env;
+
+ public XMakeBinlogSwitchTests(ITestOutputHelper output)
+ {
+ _output = output;
+ _env = TestEnvironment.Create(output);
+ }
+
+ public void Dispose() => _env.Dispose();
+
+ ///
+ /// Test that MSBUILD_LOGGING_ARGS with -bl creates a binary log.
+ ///
+ [Fact]
+ public void LoggingArgsEnvVarWithBinaryLogger()
+ {
+ var directory = _env.CreateFolder();
+ string content = ObjectModelHelpers.CleanupFileContents("");
+ var projectPath = directory.CreateFile("my.proj", content).Path;
+ string binlogPath = Path.Combine(directory.Path, "test.binlog");
+
+ _env.SetEnvironmentVariable("MSBUILD_LOGGING_ARGS", $"-bl:{binlogPath}");
+
+ string output = RunnerUtilities.ExecMSBuild($"\"{projectPath}\"", out var successfulExit, _output);
+ successfulExit.ShouldBeTrue(output);
+
+ File.Exists(binlogPath).ShouldBeTrue($"Binary log should have been created at {binlogPath}");
+ }
+
+ ///
+ /// Test that MSBUILD_LOGGING_ARGS with multiple -bl switches creates multiple binary logs.
+ ///
+ [Fact]
+ public void LoggingArgsEnvVarWithMultipleBinaryLoggers()
+ {
+ var directory = _env.CreateFolder();
+ string content = ObjectModelHelpers.CleanupFileContents("");
+ var projectPath = directory.CreateFile("my.proj", content).Path;
+ string binlogPath1 = Path.Combine(directory.Path, "test1.binlog");
+ string binlogPath2 = Path.Combine(directory.Path, "test2.binlog");
+
+ _env.SetEnvironmentVariable("MSBUILD_LOGGING_ARGS", $"-bl:{binlogPath1} -bl:{binlogPath2}");
+
+ string output = RunnerUtilities.ExecMSBuild($"\"{projectPath}\"", out var successfulExit, _output);
+ successfulExit.ShouldBeTrue(output);
+
+ File.Exists(binlogPath1).ShouldBeTrue($"First binary log should have been created at {binlogPath1}");
+ File.Exists(binlogPath2).ShouldBeTrue($"Second binary log should have been created at {binlogPath2}");
+ }
+
+ ///
+ /// Test that MSBUILD_LOGGING_ARGS with {} placeholder generates unique filenames.
+ ///
+ [Fact]
+ public void LoggingArgsEnvVarWithWildcardPlaceholder()
+ {
+ var directory = _env.CreateFolder();
+ string content = ObjectModelHelpers.CleanupFileContents("");
+ var projectPath = directory.CreateFile("my.proj", content).Path;
+
+ // Use {} placeholder for unique filename generation
+ string binlogPattern = Path.Combine(directory.Path, "build-{}.binlog");
+ _env.SetEnvironmentVariable("MSBUILD_LOGGING_ARGS", $"-bl:{binlogPattern}");
+
+ string output = RunnerUtilities.ExecMSBuild($"\"{projectPath}\"", out var successfulExit, _output);
+ successfulExit.ShouldBeTrue(output);
+
+ // Find the generated binlog file (should have unique characters instead of {})
+ string[] binlogFiles = Directory.GetFiles(directory.Path, "build-*.binlog");
+ binlogFiles.Length.ShouldBe(1, $"Expected exactly one binlog file to be created in {directory.Path}");
+
+ // The filename should not contain {} - it should have been replaced with unique characters
+ binlogFiles[0].ShouldNotContain("{}");
+ binlogFiles[0].ShouldContain("build-");
+ }
+
+ ///
+ /// Test that MSBUILD_LOGGING_ARGS with multiple {} placeholders generates unique filenames with each placeholder replaced.
+ ///
+ [Fact]
+ public void LoggingArgsEnvVarWithMultipleWildcardPlaceholders()
+ {
+ var directory = _env.CreateFolder();
+ string content = ObjectModelHelpers.CleanupFileContents("");
+ var projectPath = directory.CreateFile("my.proj", content).Path;
+
+ // Use multiple {} placeholders for unique filename generation
+ string binlogPattern = Path.Combine(directory.Path, "build-{}-test-{}.binlog");
+ _env.SetEnvironmentVariable("MSBUILD_LOGGING_ARGS", $"-bl:{binlogPattern}");
+
+ string output = RunnerUtilities.ExecMSBuild($"\"{projectPath}\"", out var successfulExit, _output);
+ successfulExit.ShouldBeTrue(output);
+
+ // Find the generated binlog file (should have unique characters instead of {})
+ string[] binlogFiles = Directory.GetFiles(directory.Path, "build-*-test-*.binlog");
+ binlogFiles.Length.ShouldBe(1, $"Expected exactly one binlog file to be created in {directory.Path}");
+
+ // The filename should not contain {} - both placeholders should have been replaced
+ binlogFiles[0].ShouldNotContain("{}");
+ binlogFiles[0].ShouldContain("build-");
+ binlogFiles[0].ShouldContain("-test-");
+ }
+
+ ///
+ /// Test that MSBUILD_LOGGING_ARGS ignores unsupported arguments and continues with valid ones.
+ ///
+ [Fact]
+ public void LoggingArgsEnvVarIgnoresUnsupportedArguments()
+ {
+ var directory = _env.CreateFolder();
+ string content = ObjectModelHelpers.CleanupFileContents("");
+ var projectPath = directory.CreateFile("my.proj", content).Path;
+ string binlogPath = Path.Combine(directory.Path, "test.binlog");
+
+ // Set env var with mixed valid and invalid arguments
+ _env.SetEnvironmentVariable("MSBUILD_LOGGING_ARGS", $"-bl:{binlogPath} -maxcpucount:4 -verbosity:detailed");
+
+ string output = RunnerUtilities.ExecMSBuild($"\"{projectPath}\"", out var successfulExit, _output);
+ successfulExit.ShouldBeTrue(output);
+
+ // Binary log should still be created (valid argument)
+ File.Exists(binlogPath).ShouldBeTrue($"Binary log should have been created at {binlogPath}");
+
+ // Warning should appear for invalid arguments
+ output.ShouldContain("MSB1070");
+ }
+
+ ///
+ /// Test that MSBUILD_LOGGING_ARGS works with /noautoresponse.
+ ///
+ [Fact]
+ public void LoggingArgsEnvVarWorksWithNoAutoResponse()
+ {
+ var directory = _env.CreateFolder();
+ string content = ObjectModelHelpers.CleanupFileContents("");
+ var projectPath = directory.CreateFile("my.proj", content).Path;
+ string binlogPath = Path.Combine(directory.Path, "test.binlog");
+
+ _env.SetEnvironmentVariable("MSBUILD_LOGGING_ARGS", $"-bl:{binlogPath}");
+
+ // Use /noautoresponse - MSBUILD_LOGGING_ARGS should still work
+ string output = RunnerUtilities.ExecMSBuild($"\"{projectPath}\" /noautoresponse", out var successfulExit, _output);
+ successfulExit.ShouldBeTrue(output);
+
+ File.Exists(binlogPath).ShouldBeTrue($"Binary log should have been created even with /noautoresponse");
+ }
+
+ ///
+ /// Test that MSBUILD_LOGGING_ARGS_LEVEL=message emits diagnostics as messages instead of warnings.
+ ///
+ [Fact]
+ public void LoggingArgsEnvVarLevelMessageSuppressesWarnings()
+ {
+ var directory = _env.CreateFolder();
+ string content = ObjectModelHelpers.CleanupFileContents("");
+ var projectPath = directory.CreateFile("my.proj", content).Path;
+
+ _env.SetEnvironmentVariable("MSBUILD_LOGGING_ARGS", "-maxcpucount:4");
+ _env.SetEnvironmentVariable("MSBUILD_LOGGING_ARGS_LEVEL", "message");
+
+ string output = RunnerUtilities.ExecMSBuild($"\"{projectPath}\"", out var successfulExit, _output);
+ successfulExit.ShouldBeTrue(output);
+
+ output.ShouldNotContain("MSB1070");
+ }
+
+ ///
+ /// Test that MSBUILD_LOGGING_ARGS emits warnings by default when MSBUILD_LOGGING_ARGS_LEVEL is not set.
+ ///
+ [Fact]
+ public void LoggingArgsEnvVarDefaultLevelEmitsWarnings()
+ {
+ var directory = _env.CreateFolder();
+ string content = ObjectModelHelpers.CleanupFileContents("");
+ var projectPath = directory.CreateFile("my.proj", content).Path;
+
+ // Set env var with invalid argument, but do NOT set MSBUILD_LOGGING_ARGS_LEVEL
+ _env.SetEnvironmentVariable("MSBUILD_LOGGING_ARGS", "-maxcpucount:4");
+
+ string output = RunnerUtilities.ExecMSBuild($"\"{projectPath}\"", out var successfulExit, _output);
+ successfulExit.ShouldBeTrue(output);
+
+ // Warning SHOULD appear when level is not set (default behavior)
+ output.ShouldContain("MSB1070");
+ }
+
+ ///
+ /// Test that empty or whitespace MSBUILD_LOGGING_ARGS is ignored.
+ ///
+ [Fact]
+ public void LoggingArgsEnvVarEmptyIsIgnored()
+ {
+ var directory = _env.CreateFolder();
+ string content = ObjectModelHelpers.CleanupFileContents("");
+ var projectPath = directory.CreateFile("my.proj", content).Path;
+
+ _env.SetEnvironmentVariable("MSBUILD_LOGGING_ARGS", " ");
+
+ string output = RunnerUtilities.ExecMSBuild($"\"{projectPath}\"", out var successfulExit, _output);
+ successfulExit.ShouldBeTrue(output);
+ }
+
+ ///
+ /// Test that -check switch is allowed in MSBUILD_LOGGING_ARGS.
+ ///
+ [Fact]
+ public void LoggingArgsEnvVarAllowsCheckSwitch()
+ {
+ var directory = _env.CreateFolder();
+ string content = ObjectModelHelpers.CleanupFileContents("");
+ var projectPath = directory.CreateFile("my.proj", content).Path;
+
+ _env.SetEnvironmentVariable("MSBUILD_LOGGING_ARGS", "-check");
+
+ string output = RunnerUtilities.ExecMSBuild($"\"{projectPath}\"", out var successfulExit, _output);
+ successfulExit.ShouldBeTrue(output);
+
+ output.ShouldNotContain("MSB1070");
+ }
+
+ ///
+ /// Test that only logging-related switches are allowed.
+ ///
+ [Theory]
+ [InlineData("-bl")]
+ [InlineData("-bl:test.binlog")]
+ [InlineData("-binarylogger")]
+ [InlineData("-binarylogger:test.binlog")]
+ [InlineData("/bl")]
+ [InlineData("/bl:test.binlog")]
+ [InlineData("--bl")]
+ [InlineData("-check")]
+ [InlineData("/check")]
+ public void LoggingArgsEnvVarAllowedSwitches(string switchArg)
+ {
+ CommandLineParser parser = new();
+ _ = _env.SetEnvironmentVariable("MSBUILD_LOGGING_ARGS", switchArg);
+
+ CommandLineSwitches switches = new();
+ List deferredBuildMessages = new();
+ parser.GatherLoggingArgsEnvironmentVariableSwitches(ref switches, deferredBuildMessages, "test");
+
+ switches.HaveErrors().ShouldBeFalse($"Switch {switchArg} should be allowed");
+ }
+
+ ///
+ /// Test that non-logging switches are rejected.
+ ///
+ [Theory]
+ [InlineData("-property:A=1")]
+ [InlineData("-target:Build")]
+ [InlineData("-verbosity:detailed")]
+ [InlineData("-maxcpucount:4")]
+ [InlineData("/p:A=1")]
+ [InlineData("-restore")]
+ [InlineData("-nologo")]
+ public void LoggingArgsEnvVarDisallowedSwitches(string switchArg)
+ {
+ var directory = _env.CreateFolder();
+ string content = ObjectModelHelpers.CleanupFileContents("");
+ var projectPath = directory.CreateFile("my.proj", content).Path;
+
+ _env.SetEnvironmentVariable("MSBUILD_LOGGING_ARGS", switchArg);
+
+ string output = RunnerUtilities.ExecMSBuild($"\"{projectPath}\"", out var successfulExit, _output);
+ successfulExit.ShouldBeTrue(output);
+
+ output.ShouldContain("MSB1070");
+ }
+ }
+}
diff --git a/src/MSBuild/CommandLine/CommandLineParser.cs b/src/MSBuild/CommandLine/CommandLineParser.cs
index ace7267233a..913e2dff2f6 100644
--- a/src/MSBuild/CommandLine/CommandLineParser.cs
+++ b/src/MSBuild/CommandLine/CommandLineParser.cs
@@ -11,8 +11,11 @@
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Xml.Linq;
+using Microsoft.Build.Framework;
using Microsoft.Build.Shared;
using Microsoft.Build.Shared.FileSystem;
+using static Microsoft.Build.CommandLine.Experimental.CommandLineSwitches;
+using static Microsoft.Build.Execution.BuildManager;
#nullable disable
@@ -60,15 +63,17 @@ internal class CommandLineParser
public CommandLineSwitchesAccessor Parse(IEnumerable commandLineArgs)
{
List args = [BuildEnvironmentHelper.Instance.CurrentMSBuildExePath, ..commandLineArgs];
+ List deferredBuildMessages = [];
GatherAllSwitches(
args,
+ deferredBuildMessages,
out CommandLineSwitches responseFileSwitches,
out CommandLineSwitches commandLineSwitches,
out string fullCommandLine,
out _);
- CommandLineSwitches result = new CommandLineSwitches();
+ CommandLineSwitches result = new();
result.Append(responseFileSwitches, fullCommandLine); // lowest precedence
result.Append(commandLineSwitches, fullCommandLine);
@@ -82,12 +87,14 @@ public CommandLineSwitchesAccessor Parse(IEnumerable commandLineArgs)
/// response files, including the auto-response file.
///
///
+ ///
///
///
///
/// Combined bag of switches.
internal void GatherAllSwitches(
IEnumerable commandLineArgs,
+ List deferredBuildMessages,
out CommandLineSwitches switchesFromAutoResponseFile,
out CommandLineSwitches switchesNotFromAutoResponseFile,
out string fullCommandLine,
@@ -119,11 +126,108 @@ internal void GatherAllSwitches(
// parse the auto-response file (if "/noautoresponse" is not specified), and combine those switches with the
// switches on the command line
switchesFromAutoResponseFile = new CommandLineSwitches();
- if (!switchesNotFromAutoResponseFile[CommandLineSwitches.ParameterlessSwitch.NoAutoResponse])
+ if (!switchesNotFromAutoResponseFile[ParameterlessSwitch.NoAutoResponse])
{
string exePath = Path.GetDirectoryName(FileUtilities.ExecutingAssemblyPath); // Copied from XMake
GatherAutoResponseFileSwitches(exePath, switchesFromAutoResponseFile, fullCommandLine);
}
+
+ CommandLineSwitches switchesFromEnvironmentVariable = new();
+ GatherLoggingArgsEnvironmentVariableSwitches(ref switchesFromEnvironmentVariable, deferredBuildMessages, fullCommandLine);
+ switchesNotFromAutoResponseFile.Append(switchesFromEnvironmentVariable, fullCommandLine);
+ }
+
+ ///
+ /// Gathers and validates logging switches from the MSBUILD_LOGGING_ARGS environment variable.
+ /// Only -bl and -check switches are allowed. All other switches are logged as warnings and ignored.
+ ///
+ internal void GatherLoggingArgsEnvironmentVariableSwitches(
+ ref CommandLineSwitches switches,
+ List deferredBuildMessages,
+ string commandLine)
+ {
+ if (string.IsNullOrWhiteSpace(Traits.MSBuildLoggingArgs))
+ {
+ return;
+ }
+
+ DeferredBuildMessageSeverity messageSeverity = Traits.Instance.EmitLogsAsMessage ? DeferredBuildMessageSeverity.Message : DeferredBuildMessageSeverity.Warning;
+
+ try
+ {
+ List envVarArgs = QuotingUtilities.SplitUnquoted(Traits.MSBuildLoggingArgs);
+
+ List validArgs = new(envVarArgs.Count);
+ List invalidArgs = null;
+
+ foreach (string arg in envVarArgs)
+ {
+ string unquotedArg = QuotingUtilities.Unquote(arg);
+ if (string.IsNullOrWhiteSpace(unquotedArg))
+ {
+ continue;
+ }
+
+ if (IsAllowedLoggingArg(unquotedArg))
+ {
+ validArgs.Add(arg);
+ }
+ else
+ {
+ invalidArgs ??= [];
+ invalidArgs.Add(unquotedArg);
+ }
+ }
+
+ if (invalidArgs != null)
+ {
+ foreach (string invalidArg in invalidArgs)
+ {
+ var message = ResourceUtilities.FormatResourceStringStripCodeAndKeyword(out string warningCode, out _, "LoggingArgsEnvVarUnsupportedArgument", invalidArg);
+ deferredBuildMessages.Add(new DeferredBuildMessage(message, warningCode, messageSeverity));
+ }
+ }
+
+ if (validArgs.Count > 0)
+ {
+ deferredBuildMessages.Add(new DeferredBuildMessage(ResourceUtilities.FormatResourceStringIgnoreCodeAndKeyword("LoggingArgsEnvVarUsing", string.Join(" ", validArgs)), MessageImportance.Low));
+ GatherCommandLineSwitches(validArgs, switches, commandLine);
+ }
+ }
+ catch (Exception ex)
+ {
+ var message = ResourceUtilities.FormatResourceStringStripCodeAndKeyword(out string errorCode, out _, "LoggingArgsEnvVarError", ex.ToString());
+ deferredBuildMessages.Add(new DeferredBuildMessage(message, errorCode, messageSeverity));
+ }
+ }
+
+ ///
+ /// Checks if the argument is an allowed logging argument (-bl or -check).
+ ///
+ /// The unquoted argument to check.
+ /// True if the argument is allowed, false otherwise.
+ private bool IsAllowedLoggingArg(string arg)
+ {
+ if (!ValidateSwitchIndicatorInUnquotedArgument(arg))
+ {
+ return false;
+ }
+
+ ReadOnlySpan switchPart = arg.AsSpan(GetLengthOfSwitchIndicator(arg));
+
+ // Extract switch name (before any ':' parameter indicator)
+ int colonIndex = switchPart.IndexOf(':');
+ ReadOnlySpan switchNameSpan = colonIndex >= 0 ? switchPart.Slice(0, colonIndex) : switchPart;
+ string switchName = switchNameSpan.ToString();
+
+ return IsParameterizedSwitch(
+ switchName,
+ out ParameterizedSwitch paramSwitch,
+ out _,
+ out _,
+ out _,
+ out _,
+ out _) && (paramSwitch == ParameterizedSwitch.BinaryLogger || paramSwitch == ParameterizedSwitch.Check);
}
///
diff --git a/src/MSBuild/Resources/Strings.resx b/src/MSBuild/Resources/Strings.resx
index 0c9087351cb..6e75cc0db7e 100644
--- a/src/MSBuild/Resources/Strings.resx
+++ b/src/MSBuild/Resources/Strings.resx
@@ -1704,10 +1704,25 @@
Duplicate binary log path(s) specified and ignored: {0}{0} is the list of duplicate paths that were filtered out
+
+
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is a string with the command-line arguments from the environment variable.
+
+
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ {StrBegin="MSB1070: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the unsupported argument.
+
+
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ {StrBegin="MSB1071: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the error message.
+
+
+
diff --git a/src/MSBuild/Resources/xlf/Strings.cs.xlf b/src/MSBuild/Resources/xlf/Strings.cs.xlf
index 6f21a13ec84..4c5a6b3efa8 100644
--- a/src/MSBuild/Resources/xlf/Strings.cs.xlf
+++ b/src/MSBuild/Resources/xlf/Strings.cs.xlf
@@ -35,7 +35,7 @@
Duplicate binary log path(s) specified and ignored: {0}
- Byly zadány duplicitní cesty k binárnímu protokolu a byly ignorovány: {0}
+ Duplicate binary log path(s) specified and ignored: {0}{0} is the list of duplicate paths that were filtered out
@@ -335,6 +335,21 @@
LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized.
+
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ {StrBegin="MSB1071: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the error message.
+
+
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ {StrBegin="MSB1070: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the unsupported argument.
+
+
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is a string with the command-line arguments from the environment variable.
+ Based on the Windows registry key LongPathsEnabled, the LongPaths feature is {0}.Na základě klíče registru Windows LongPathsEnabled má funkce LongPaths hodnotu {0}.
diff --git a/src/MSBuild/Resources/xlf/Strings.de.xlf b/src/MSBuild/Resources/xlf/Strings.de.xlf
index 71d5bf1961e..cadcfd4dd48 100644
--- a/src/MSBuild/Resources/xlf/Strings.de.xlf
+++ b/src/MSBuild/Resources/xlf/Strings.de.xlf
@@ -35,7 +35,7 @@
Duplicate binary log path(s) specified and ignored: {0}
- Doppelte Binärprotokollpfade angegeben und ignoriert: {0}
+ Duplicate binary log path(s) specified and ignored: {0}{0} is the list of duplicate paths that were filtered out
@@ -335,6 +335,21 @@
LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized.
+
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ {StrBegin="MSB1071: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the error message.
+
+
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ {StrBegin="MSB1070: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the unsupported argument.
+
+
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is a string with the command-line arguments from the environment variable.
+ Based on the Windows registry key LongPathsEnabled, the LongPaths feature is {0}.Basierend auf dem Windows-Registrierungsschlüssel LongPathsEnabled ist das Feature LongPaths {0}.
diff --git a/src/MSBuild/Resources/xlf/Strings.es.xlf b/src/MSBuild/Resources/xlf/Strings.es.xlf
index f67f93029d0..cf14afb978a 100644
--- a/src/MSBuild/Resources/xlf/Strings.es.xlf
+++ b/src/MSBuild/Resources/xlf/Strings.es.xlf
@@ -35,7 +35,7 @@
Duplicate binary log path(s) specified and ignored: {0}
- Rutas de registro binarias duplicadas especificadas y omitidas: {0}
+ Duplicate binary log path(s) specified and ignored: {0}{0} is the list of duplicate paths that were filtered out
@@ -334,6 +334,21 @@ Esta marca es experimental y puede que no funcione según lo previsto.
LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized.
+
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ {StrBegin="MSB1071: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the error message.
+
+
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ {StrBegin="MSB1070: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the unsupported argument.
+
+
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is a string with the command-line arguments from the environment variable.
+ Based on the Windows registry key LongPathsEnabled, the LongPaths feature is {0}.De acuerdo con la clave del Registro de Windows LongPathsEnabled, la característica LongPaths está {0}.
diff --git a/src/MSBuild/Resources/xlf/Strings.fr.xlf b/src/MSBuild/Resources/xlf/Strings.fr.xlf
index 027581abd70..96f4aa0130a 100644
--- a/src/MSBuild/Resources/xlf/Strings.fr.xlf
+++ b/src/MSBuild/Resources/xlf/Strings.fr.xlf
@@ -35,7 +35,7 @@
Duplicate binary log path(s) specified and ignored: {0}
- Chemins d'accès aux journaux binaires en double spécifiés et ignorés : {0}
+ Duplicate binary log path(s) specified and ignored: {0}{0} is the list of duplicate paths that were filtered out
@@ -335,6 +335,21 @@ futures
LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized.
+
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ {StrBegin="MSB1071: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the error message.
+
+
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ {StrBegin="MSB1070: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the unsupported argument.
+
+
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is a string with the command-line arguments from the environment variable.
+ Based on the Windows registry key LongPathsEnabled, the LongPaths feature is {0}.D’après la clé de Registre Windows LongPathsEnabled, la fonctionnalité LongPaths est {0}.
diff --git a/src/MSBuild/Resources/xlf/Strings.it.xlf b/src/MSBuild/Resources/xlf/Strings.it.xlf
index 6642ab382c0..0c7056c3663 100644
--- a/src/MSBuild/Resources/xlf/Strings.it.xlf
+++ b/src/MSBuild/Resources/xlf/Strings.it.xlf
@@ -35,7 +35,7 @@
Duplicate binary log path(s) specified and ignored: {0}
- Percorsi di log binari duplicati specificati e ignorati: {0}
+ Duplicate binary log path(s) specified and ignored: {0}{0} is the list of duplicate paths that were filtered out
@@ -335,6 +335,21 @@ Questo flag è sperimentale e potrebbe non funzionare come previsto.
LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized.
+
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ {StrBegin="MSB1071: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the error message.
+
+
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ {StrBegin="MSB1070: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the unsupported argument.
+
+
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is a string with the command-line arguments from the environment variable.
+ Based on the Windows registry key LongPathsEnabled, the LongPaths feature is {0}.In base alla chiave del Registro di sistema di Windows LongPathsEnabled, la funzionalità LongPaths è {0}.
diff --git a/src/MSBuild/Resources/xlf/Strings.ja.xlf b/src/MSBuild/Resources/xlf/Strings.ja.xlf
index 581a5984de9..3c818d6fbb2 100644
--- a/src/MSBuild/Resources/xlf/Strings.ja.xlf
+++ b/src/MSBuild/Resources/xlf/Strings.ja.xlf
@@ -35,7 +35,7 @@
Duplicate binary log path(s) specified and ignored: {0}
- 重複するバイナリ ログ パスが指定され、次は無視されました: {0}
+ Duplicate binary log path(s) specified and ignored: {0}{0} is the list of duplicate paths that were filtered out
@@ -335,6 +335,21 @@
LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized.
+
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ {StrBegin="MSB1071: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the error message.
+
+
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ {StrBegin="MSB1070: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the unsupported argument.
+
+
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is a string with the command-line arguments from the environment variable.
+ Based on the Windows registry key LongPathsEnabled, the LongPaths feature is {0}.Windows レジストリ キー LongPathsEnabled に基づいて、LongPaths 機能は{0}です。
diff --git a/src/MSBuild/Resources/xlf/Strings.ko.xlf b/src/MSBuild/Resources/xlf/Strings.ko.xlf
index acdf0b64430..411c1d95294 100644
--- a/src/MSBuild/Resources/xlf/Strings.ko.xlf
+++ b/src/MSBuild/Resources/xlf/Strings.ko.xlf
@@ -35,7 +35,7 @@
Duplicate binary log path(s) specified and ignored: {0}
- 중복된 이진 로그 경로가 지정되어 무시되었습니다. {0}
+ Duplicate binary log path(s) specified and ignored: {0}{0} is the list of duplicate paths that were filtered out
@@ -336,6 +336,21 @@
LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized.
+
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ {StrBegin="MSB1071: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the error message.
+
+
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ {StrBegin="MSB1070: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the unsupported argument.
+
+
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is a string with the command-line arguments from the environment variable.
+ Based on the Windows registry key LongPathsEnabled, the LongPaths feature is {0}.Windows 레지스트리 키 LongPathsEnabled에 따라 LongPaths 기능이 {0}입니다.
diff --git a/src/MSBuild/Resources/xlf/Strings.pl.xlf b/src/MSBuild/Resources/xlf/Strings.pl.xlf
index ad0cfa8541a..5ce6bbfc336 100644
--- a/src/MSBuild/Resources/xlf/Strings.pl.xlf
+++ b/src/MSBuild/Resources/xlf/Strings.pl.xlf
@@ -35,7 +35,7 @@
Duplicate binary log path(s) specified and ignored: {0}
- Określono i zignorowano zduplikowane ścieżki dziennika binarnego: {0}
+ Duplicate binary log path(s) specified and ignored: {0}{0} is the list of duplicate paths that were filtered out
@@ -334,6 +334,21 @@ Ta flaga jest eksperymentalna i może nie działać zgodnie z oczekiwaniami.
LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized.
+
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ {StrBegin="MSB1071: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the error message.
+
+
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ {StrBegin="MSB1070: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the unsupported argument.
+
+
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is a string with the command-line arguments from the environment variable.
+ Based on the Windows registry key LongPathsEnabled, the LongPaths feature is {0}.Na podstawie klucza rejestru systemu Windows LongPathsEnabled funkcja LongPaths jest {0}.
diff --git a/src/MSBuild/Resources/xlf/Strings.pt-BR.xlf b/src/MSBuild/Resources/xlf/Strings.pt-BR.xlf
index 5be904253d7..1bcf3e21a22 100644
--- a/src/MSBuild/Resources/xlf/Strings.pt-BR.xlf
+++ b/src/MSBuild/Resources/xlf/Strings.pt-BR.xlf
@@ -35,7 +35,7 @@
Duplicate binary log path(s) specified and ignored: {0}
- Caminhos de log binários duplicados especificados e ignorados: {0}
+ Duplicate binary log path(s) specified and ignored: {0}{0} is the list of duplicate paths that were filtered out
@@ -334,6 +334,21 @@
LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized.
+
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ {StrBegin="MSB1071: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the error message.
+
+
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ {StrBegin="MSB1070: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the unsupported argument.
+
+
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is a string with the command-line arguments from the environment variable.
+ Based on the Windows registry key LongPathsEnabled, the LongPaths feature is {0}.Com base na chave do Registro do Windows LongPathsEnabled, o recurso LongPaths é {0}.
diff --git a/src/MSBuild/Resources/xlf/Strings.ru.xlf b/src/MSBuild/Resources/xlf/Strings.ru.xlf
index 93bd4c31f7c..4d1ae14ff24 100644
--- a/src/MSBuild/Resources/xlf/Strings.ru.xlf
+++ b/src/MSBuild/Resources/xlf/Strings.ru.xlf
@@ -35,7 +35,7 @@
Duplicate binary log path(s) specified and ignored: {0}
- Указаны повторяющиеся пути к двоичным журналам, которые были проигнорированы: {0}
+ Duplicate binary log path(s) specified and ignored: {0}{0} is the list of duplicate paths that were filtered out
@@ -334,6 +334,21 @@
LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized.
+
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ {StrBegin="MSB1071: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the error message.
+
+
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ {StrBegin="MSB1070: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the unsupported argument.
+
+
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is a string with the command-line arguments from the environment variable.
+ Based on the Windows registry key LongPathsEnabled, the LongPaths feature is {0}.На основе раздела реестра Windows LongPathsEnabled функция LongPaths имеет значение {0}.
diff --git a/src/MSBuild/Resources/xlf/Strings.tr.xlf b/src/MSBuild/Resources/xlf/Strings.tr.xlf
index aed787a4237..3b8cdeb76ff 100644
--- a/src/MSBuild/Resources/xlf/Strings.tr.xlf
+++ b/src/MSBuild/Resources/xlf/Strings.tr.xlf
@@ -35,7 +35,7 @@
Duplicate binary log path(s) specified and ignored: {0}
- Belirtilen ve yok sayılan yinelenen ikili günlük yolları: {0}
+ Duplicate binary log path(s) specified and ignored: {0}{0} is the list of duplicate paths that were filtered out
@@ -334,6 +334,21 @@
LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized.
+
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ {StrBegin="MSB1071: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the error message.
+
+
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ {StrBegin="MSB1070: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the unsupported argument.
+
+
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is a string with the command-line arguments from the environment variable.
+ Based on the Windows registry key LongPathsEnabled, the LongPaths feature is {0}.Windows kayıt defteri anahtarı LongPathsEnabled ayarına bağlı olarak LongPaths özelliği {0}.
diff --git a/src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf b/src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf
index b02080e6e1d..11864fab049 100644
--- a/src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf
+++ b/src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf
@@ -35,7 +35,7 @@
Duplicate binary log path(s) specified and ignored: {0}
- 指定且忽略的重复二进制日志路径: {0}
+ Duplicate binary log path(s) specified and ignored: {0}{0} is the list of duplicate paths that were filtered out
@@ -335,6 +335,21 @@
LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized.
+
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ {StrBegin="MSB1071: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the error message.
+
+
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ {StrBegin="MSB1070: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the unsupported argument.
+
+
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is a string with the command-line arguments from the environment variable.
+ Based on the Windows registry key LongPathsEnabled, the LongPaths feature is {0}.基于 Windows 注册表项 LongPathsEnabled,LongPaths 功能为 {0}。
diff --git a/src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf b/src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf
index 2be999c8a3e..3148a590c4d 100644
--- a/src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf
+++ b/src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf
@@ -35,7 +35,7 @@
Duplicate binary log path(s) specified and ignored: {0}
- 指定了重複的二進位記錄路徑,並已忽略: {0}
+ Duplicate binary log path(s) specified and ignored: {0}{0} is the list of duplicate paths that were filtered out
@@ -335,6 +335,21 @@
LOCALIZATION: The prefix "MSBUILD : error MSBxxxx:" should not be localized.
+
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ MSB1071: Error processing MSBUILD_LOGGING_ARGS environment variable: {0}
+ {StrBegin="MSB1071: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the error message.
+
+
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ MSB1070: MSBUILD_LOGGING_ARGS: Ignoring unsupported argument '{0}'. Only -bl and -check arguments are allowed.
+ {StrBegin="MSB1070: "}LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is the unsupported argument.
+
+
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ Using arguments from MSBUILD_LOGGING_ARGS environment variable: {0}
+ LOCALIZATION: "MSBUILD_LOGGING_ARGS" should not be localized. {0} is a string with the command-line arguments from the environment variable.
+ Based on the Windows registry key LongPathsEnabled, the LongPaths feature is {0}.根據 Windows 登錄機碼 LongPathsEnabled,LongPaths 功能為 {0}。
diff --git a/src/MSBuild/XMake.cs b/src/MSBuild/XMake.cs
index ddb0fc04240..f73781e4bf6 100644
--- a/src/MSBuild/XMake.cs
+++ b/src/MSBuild/XMake.cs
@@ -306,7 +306,14 @@ private static bool CanRunServerBasedOnCommandLineSwitches(string[] commandLine)
bool canRunServer = true;
try
{
- commandLineParser.GatherAllSwitches(commandLine, out var switchesFromAutoResponseFile, out var switchesNotFromAutoResponseFile, out string fullCommandLine, out s_exeName);
+ commandLineParser.GatherAllSwitches(
+ commandLine,
+ s_globalMessagesToLogInBuildLoggers,
+ out CommandLineSwitches switchesFromAutoResponseFile,
+ out CommandLineSwitches switchesNotFromAutoResponseFile,
+ out string fullCommandLine,
+ out s_exeName);
+
CommandLineSwitches commandLineSwitches = CombineSwitchesRespectingPriority(switchesFromAutoResponseFile, switchesNotFromAutoResponseFile, fullCommandLine);
if (commandLineParser.CheckAndGatherProjectAutoResponseFile(switchesFromAutoResponseFile, commandLineSwitches, false, fullCommandLine))
{
@@ -681,7 +688,7 @@ public static ExitType Execute(string[] commandLine)
bool reportFileAccesses = false;
#endif
- commandLineParser.GatherAllSwitches(commandLine, out var switchesFromAutoResponseFile, out var switchesNotFromAutoResponseFile, out _, out s_exeName);
+ commandLineParser.GatherAllSwitches(commandLine, s_globalMessagesToLogInBuildLoggers, out var switchesFromAutoResponseFile, out var switchesNotFromAutoResponseFile, out _, out s_exeName);
bool buildCanBeInvoked = ProcessCommandLineSwitches(
switchesFromAutoResponseFile,