Skip to content
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

Don't show welcome message when --getProperty was passed #38444

Closed
rotanov opened this issue Feb 1, 2024 · 5 comments
Closed

Don't show welcome message when --getProperty was passed #38444

rotanov opened this issue Feb 1, 2024 · 5 comments
Assignees
Labels
Area-CLI untriaged Request triage from a team member

Comments

@rotanov
Copy link

rotanov commented Feb 1, 2024

When a user executes dotnet build command with --getProperty, for example:

dotnet build -c <configuration> --getProperty:OutputPath --getProperty:OutputType --getProperty:AssemblyName <project>

Most likely that it's output is gonna be parsed.

However in some cases (or every time in CI, in clean docker environment) the welcome message is being prepended to the output, which breaks parsing.

I've seen #3828 and dotnet/cli#13275 but it seems to me in this case it's clear that user never wants a welcome message, so can you consider never showing welcome message if --getProperty was passed?

Also, bonus suggestion, may be everyone will benefit if welcome message is only displayed when dotnet (or dotnet build in case welcome message is tied only with build command) is executed with no arguments?

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-CLI untriaged Request triage from a team member labels Feb 1, 2024
@baronfel
Copy link
Member

baronfel commented Feb 1, 2024

This will be more difficult to do than folks expect - the SDK's understanding of MSBuild properties (like -getProperty) is limited, and the MSBuild parsing logic happens much further along than the welcome message. We'd have to do some serious reshuffling. More broadly we have requests to look at how the SDK can spew text to stdout, and we think the more comprehensive approach would be to make out-of-band information like the welcome message write to stderr instead of stdout. This will require some finess, though, because until recently Powershell interpreted anything written to stderr as an actual error.

@rotanov
Copy link
Author

rotanov commented Feb 1, 2024

Also, environment variable DOTNET_NOLOGO doesn't seem to work anymore.

@rotanov
Copy link
Author

rotanov commented Feb 1, 2024

because until recently Powershell interpreted anything written to stderr as an actual error

Yeah, if that's the case, it will fail CI job

@rotanov
Copy link
Author

rotanov commented Feb 1, 2024

This will be more difficult to do than folks expect - the SDK's understanding of MSBuild properties (like -getProperty) is limited

If welcome message is SDK's thing and not a dotnet build thing, then what about my "bonus suggestion" i.e. to only show welcome message when no arguments are passed to dotnet? Does your comment stand still in that case?

@rotanov
Copy link
Author

rotanov commented Feb 1, 2024

Update:
We tried following workarounds:

  1. DOTNET_NOLOGO=1 doesn't work

Next, we decided to try running some dotnet command which will trigger welcome message first (in before_script: section of gitlab ci), so actually useful commands in the job won't display it:

  1. dotnet doesn't trigger welcome message
  2. dotnet build DOES trigger welcome message, but returns non zero exit code and fails the job
  3. dotnet --info doesn't trigger welcome message

So, in other words, commands which I expect to display welcome message are not showing it, and commands which I expect to do the job do show the welcome message.

Edit:

  1. dotnet build -help serves as a workaround:
.base_job:
    before_script:
        - $ErrorActionPreference = "Stop";
        - dotnet build -help

A lot of unwanted text in the log though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-CLI untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

3 participants