Skip to content

Use terminal logger when building file-based apps #49385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2025

Conversation

jjonescz
Copy link
Member

No description provided.

@jjonescz jjonescz added the Area-run-file Items related to the "dotnet run <file>" effort label Jun 13, 2025
@jjonescz jjonescz requested a review from a team June 13, 2025 11:22
@@ -88,8 +84,8 @@ public VirtualProjectBuildingCommand(
public override int Execute()
{
Debug.Assert(!(NoRestore && NoBuild));
var consoleLogger = RunCommand.MakeTerminalLogger(Verbosity);
var binaryLogger = GetBinaryLogger(BinaryLoggerArgs);
var consoleLogger = TerminalLogger.CreateTerminalOrConsoleLogger(LoggerArgs);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did RunCommand.MakeTerminalLogger not create a terminal logger, you ask? No:

internal static ILogger MakeTerminalLogger(VerbosityOptions? verbosity)
{
var msbuildVerbosity = ToLoggerVerbosity(verbosity);
// Temporary fix for 9.0.1xx. 9.0.2xx will use the TerminalLogger in the safe way.
var thing = new ConsoleLogger(msbuildVerbosity);
return thing!;
}

But I'm not confident that should change, because that's used for evaluating the project after it's built and if terminal logger is used there, it results in additional "Build succeeded in 0.0s" message like:

image

whereas if the evaluation phase continues to use the console logger, it's nicely quiet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC what I was planning to do was crank down the verbosity for the evaluations when I went back to TL to prevent that addtional output, but you have a point

IReadOnlyList<string> msbuildArgs,
VerbosityOptions? verbosity,
bool interactive)
string[] msbuildArgs)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not call it loggerArgs so it lines up with the property name?

Suggested change
string[] msbuildArgs)
string[] loggerArgs)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also used to fill GlobalProperties, only afterwards the property is used for logger construction, hence LoggerArgs.

{
Debug.Assert(Path.IsPathFullyQualified(entryPointFileFullPath));

EntryPointFileFullPath = entryPointFileFullPath;
GlobalProperties = new(StringComparer.OrdinalIgnoreCase);
CommonRunHelpers.AddUserPassedProperties(GlobalProperties, msbuildArgs);
BinaryLoggerArgs = msbuildArgs;
Verbosity = verbosity ?? RunCommand.GetDefaultVerbosity(interactive: interactive);
LoggerArgs = msbuildArgs;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LoggerArgs = msbuildArgs;
LoggerArgs = loggerArgs;

@baronfel baronfel merged commit fe6a95a into dotnet:main Jun 13, 2025
32 checks passed
@jjonescz jjonescz deleted the run-tl branch June 16, 2025 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-run-file Items related to the "dotnet run <file>" effort
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants