diff --git a/src/MSBuild/XMake.cs b/src/MSBuild/XMake.cs index 7ebb7971909..3c2c494eec0 100644 --- a/src/MSBuild/XMake.cs +++ b/src/MSBuild/XMake.cs @@ -2516,6 +2516,11 @@ private static bool ProcessCommandLineSwitches( #endif bool useTerminalLogger = ProcessTerminalLoggerConfiguration(commandLineSwitches, out string aggregatedTerminalLoggerParameters); + + // This is temporary until we can remove the need for the environment variable. + // DO NOT use this environment variable for any new features as it will be removed without further notice. + Environment.SetEnvironmentVariable("_MSBUILDTLENABLED", useTerminalLogger ? "1" : "0"); + DisplayVersionMessageIfNeeded(recursing, useTerminalLogger, commandLineSwitches); // Idle priority would prevent the build from proceeding as the user does normal actions. diff --git a/src/UnitTests.Shared/TestEnvironment.cs b/src/UnitTests.Shared/TestEnvironment.cs index d961178b298..045fce7ffb9 100644 --- a/src/UnitTests.Shared/TestEnvironment.cs +++ b/src/UnitTests.Shared/TestEnvironment.cs @@ -442,6 +442,11 @@ void AssertDictionaryInclusion(IDictionary superset, IDictionary subset, string { foreach (var key in subset.Keys) { + if (key is "_MSBUILDTLENABLED") + { + continue; + } + // workaround for https://github.com/dotnet/msbuild/pull/3866 // if the initial environment had empty keys, then MSBuild will accidentally remove them via Environment.SetEnvironmentVariable if (operation != "removed" || !string.IsNullOrEmpty((string)subset[key]))