Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Build.UnitTests/Utilities_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public void CommentsInPreprocessing()
TransientTestFile outputFile = env.CreateFile("tempOutput.tmp");

env.SetEnvironmentVariable("MSBUILDLOADALLFILESASWRITEABLE", "1");
env.SetEnvironmentVariable("_MSBUILDTLENABLED", "0");

#if FEATURE_GET_COMMANDLINE
MSBuildApp.Execute(@"c:\bin\msbuild.exe """ + inputFile.Path +
Expand Down
2 changes: 2 additions & 0 deletions src/MSBuild.UnitTests/CommandLineSwitches_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1522,6 +1522,8 @@ public void ProcessInvalidTargetSwitch()
</Project>
""";
using TestEnvironment testEnvironment = TestEnvironment.Create();
testEnvironment.SetEnvironmentVariable("_MSBUILDTLENABLED", "0");

string project = testEnvironment.CreateTestProjectWithFiles("project.proj", projectContent).ProjectFile;

#if FEATURE_GET_COMMANDLINE
Expand Down
3 changes: 3 additions & 0 deletions src/MSBuild.UnitTests/XMake_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,8 @@ public void VersionSwitchDisableChangeWave()
public void ErrorCommandLine()
{
string oldValueForMSBuildLoadMicrosoftTargetsReadOnly = Environment.GetEnvironmentVariable("MSBuildLoadMicrosoftTargetsReadOnly");
string oldValueForMSBuildTLEnabled = Environment.GetEnvironmentVariable("_MSBUILDTLENABLED");

#if FEATURE_GET_COMMANDLINE
MSBuildApp.Execute(@"c:\bin\msbuild.exe -junk").ShouldBe(MSBuildApp.ExitType.SwitchError);

Expand All @@ -627,6 +629,7 @@ public void ErrorCommandLine()
MSBuildApp.Execute(new[] { @"msbuild.exe", "@bogus.rsp" }).ShouldBe(MSBuildApp.ExitType.InitializationError);
#endif
Environment.SetEnvironmentVariable("MSBuildLoadMicrosoftTargetsReadOnly", oldValueForMSBuildLoadMicrosoftTargetsReadOnly);
Environment.SetEnvironmentVariable("_MSBUILDTLENABLED", oldValueForMSBuildTLEnabled);
}

[Fact]
Expand Down
5 changes: 5 additions & 0 deletions src/MSBuild/XMake.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down