Suppress welcome message with get* builds Fixes #38444#47197
Suppress welcome message with get* builds Fixes #38444#47197Forgind merged 2 commits intodotnet:release/9.0.3xxfrom
Conversation
There was a problem hiding this comment.
PR Overview
This PR fixes issue #38444 by suppressing the welcome message when a get* build option (getProperty, getItem, or getTargetResult) is used. The changes detect these options in the parsed token list and pass a flag to defer the first time use initialization in both Program.cs and DotnetFirstTimeUseConfigurer.cs.
- Added detection in the command-line parsing to identify get* options.
- Updated first time use configuration logic to conditionally skip the welcome message.
- Modified DotnetFirstTimeUseConfigurer to accept and use a new flag for skipping first use checks.
Reviewed Changes
| File | Description |
|---|---|
| src/Cli/dotnet/Program.cs | Adds detection for get* operators and passes a flag to suppress the welcome message |
| src/Cli/Microsoft.DotNet.Configurer/DotnetFirstTimeUseConfigurer.cs | Adjusts the first time use configuration to honor the new skip flag |
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
src/Cli/dotnet/Program.cs:197
- [nitpick] Consider renaming 'getStarOptionPassed' to a name like 'suppressWelcomeMessage' to more clearly reflect its purpose.
var getStarOptionPassed = parseResult.CommandResult.Tokens.Any(t =>
src/Cli/Microsoft.DotNet.Configurer/DotnetFirstTimeUseConfigurer.cs:54
- Ensure there are tests covering scenarios where '_skipFirstTimeUseCheck' is true to verify that the welcome message is properly suppressed when intended.
var isFirstTimeUse = !_skipFirstTimeUseCheck && !_firstTimeUseNoticeSentinel.Exists();
dsplaisted
left a comment
There was a problem hiding this comment.
We should fix this, and it sounds like there's not a really clean way to do so, so this may be the best we can do.
👍
src/Cli/dotnet/Program.cs
Outdated
| var getStarOptionPassed = parseResult.CommandResult.Tokens.Any(t => | ||
| t.Value.Contains("getProperty", StringComparison.OrdinalIgnoreCase) || | ||
| t.Value.Contains("getItem", StringComparison.OrdinalIgnoreCase) || | ||
| t.Value.Contains("getTargetResult", StringComparison.OrdinalIgnoreCase)); |
There was a problem hiding this comment.
Instead of just checking that the string contains these values, could we check that it starts with / or - followed by the value?
Fixes #38444
This looks at the parseResult and scans it for any of the get* operators: getProperty, getItem, or getTargetResult. If it finds any of them (via string checks), it defers the first use message for the next operation. As the output from get* operators is often parsed, this dramatically simplifies that parsing.
This is the result when calling
dotnet build -getProperty:TargetFrameworkfollowed by another command that would normally print the welcome message:Notice that the welcome message is still shown (and continues below the screenshot) but does not appear in the part often parsed.