Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 29, 2025

Customer Issue

Current description for --solution (dotnet test):

Defines the path of the solution file to run. If not specified, it defaults to the current directory.

Current description for --project (dotnet test):

Defines the path of the project file to run (folder name or full path). If not specified, it defaults to the current directory.

This is confusing to users because both command-line options accept either full path to project/solution or just the directory. Moreover, the description says "run" instead "test".

Current description for --project (dotnet run):

The path to the project file to run (defaults to the current directory if there is only one project).

We would like to align these for correctness and consistency.

Description

Tiny help text change to --project (both run and test commands) and --solution (test command).
PR link: #51052

Testing

Automated tests were updated.

Risk

Low - only updates CLI description strings.

  • Analyze the issue: Description of --solution and --project options in MTP dotnet test use "run" instead of "test"
  • Identify the root cause: CmdProjectDescription and CmdSolutionDescription in CliCommandStrings.resx contain "run" instead of "test"
  • Confirm that Run command has separate descriptions (CommandOptionProjectDescription) which are correct
  • Create test-specific descriptions for project and solution options in CliCommandStrings.resx
  • Update MicrosoftTestingPlatformOptions.cs to use the new test-specific descriptions
  • Test the changes to ensure help text shows correct descriptions
  • Verify run command still works correctly with its original descriptions
  • Run tests to ensure no regressions
  • Revert all unintended formatting changes
  • Extract shared localization strings with verb parameter and create factory methods
  • Make verb strings ("run", "test") localizable
  • Remove unused resource strings
  • Update completion test snapshots

Changes Made:

  1. Created parameterized resource strings CmdProjectDescriptionFormat and CmdSolutionDescriptionFormat in CliCommandStrings.resx that accept a verb parameter
  2. Added factory methods ProjectOption(string verb) and SolutionOption(string verb) in CommonOptions.cs
  3. Created localized verb resources VerbRun and VerbTest in CliCommandStrings.resx
  4. Updated MicrosoftTestingPlatformOptions.cs to use CommonOptions.ProjectOption(CliCommandStrings.VerbTest) and CommonOptions.SolutionOption(CliCommandStrings.VerbTest)
  5. Updated RunCommandParser.cs to use CommonOptions.ProjectOption(CliCommandStrings.VerbRun)
  6. Removed unused resources: CmdProjectDescription and CommandOptionProjectDescription
  7. Updated completion test snapshots (zsh and pwsh) with new project option description
  8. Both commands now share the same localization string pattern with localizable verbs

Verification:

  • dotnet test --help (with MTP enabled) shows "Defines the path of the project file to test..." and "Defines the path of the solution file to test..."
  • dotnet run --help shows "Defines the path of the project file to run..."
  • Build succeeds
  • The verbs are now properly localizable, ensuring consistent translations across all languages
  • Unused resources have been cleaned up
  • Completion test snapshots updated with new description format
Original prompt

This section details on the original issue you should resolve

<issue_title>Description of --solution of MTP dotnet test should be worded similarly to --project</issue_title>
<issue_description>

<data name="CmdSolutionDescription" xml:space="preserve">
<value>Defines the path of the solution file to run. If not specified, it defaults to the current directory.</value>
</data>

<data name="CmdProjectDescription" xml:space="preserve">
<value>Defines the path of the project file to run (folder name or full path). If not specified, it defaults to the current directory.</value>
</data>
</issue_description>

Comments on the Issue (you are @copilot in this section)

@Youssef1313 Also, the description says "run", but should be `test` for `dotnet test` (the description for `--project` is currently shared between run and test commands) @baronfel @Youssef1313 definitely agree - copilot should be able to handle this similar to https://github.com//pull/51042 if you don't want to spend personal time on it.
Fixes #51051

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] Description of --solution of MTP dotnet test should be worded similarly to --project Fix --project and --solution descriptions for dotnet test MTP to use "test" instead of "run" Sep 29, 2025
@Copilot Copilot AI requested a review from Youssef1313 September 29, 2025 14:34
Copilot finished work on behalf of Youssef1313 September 29, 2025 14:34
@Copilot Copilot AI requested a review from Youssef1313 October 1, 2025 08:28
Copilot finished work on behalf of Youssef1313 October 1, 2025 08:28
<note />
</trans-unit>
<trans-unit id="TestCmdProjectDescription">
<source>Defines the path of the project file to test (folder name or full path). If not specified, it defaults to the current directory.</source>
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
<source>Defines the path of the project file to test (folder name or full path). If not specified, it defaults to the current directory.</source>
<source>Defines the path of the project file to test. Use path to the project file, or path to the directory containing the project file. If not specified, it defaults to the current directory.</source>

I would formulate it like this, because the current wording forces me to do too much thinking. It says that I should specify the path to the project, but then it talks about folder name or full path. These two are not the opposites in my eyes,

folder name is not the same as relative or full path to a folder.
and full path, is not the same as relative or full path to the project file.

Copy link
Member

Choose a reason for hiding this comment

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

@copilot please apply the change in wording to the resources, and re-build so we get the updates.

Copy link
Member

Choose a reason for hiding this comment

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

I was following the same wording as used by dotnet run. I prefer to keep both in sync, so I went ahead and updated it for both test and run.

@jjonescz Any concerns about the resource rewording here?

Copy link
Member

Choose a reason for hiding this comment

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

looks good to me

@Copilot Copilot AI requested a review from nohwnd October 2, 2025 10:10
Copilot finished work on behalf of nohwnd October 2, 2025 10:10
public static readonly Option<string> ProjectOption = new("--project")
{
Description = CliCommandStrings.CmdProjectDescription,
Description = CliCommandStrings.TestCmdProjectDescription,
Copy link
Member

Choose a reason for hiding this comment

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

I have a minor nit: the strings for run and test are the same except for the 'verb' used - we've been extracting this pattern out to shared strings and providing the 'verb' as a parameter when creating the Option/Argument.

@copilot can you extract the shared loc string and update the test and run usages of the Project and Solution options to use the shared string, passing in the matching verb?

Copy link
Member

Choose a reason for hiding this comment

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

@baronfel Is it fine if the words "run"/"test" are not localized? Or do we want to also have resources with "single" words for "run" and "test" so they are localized?

Copy link
Member

Choose a reason for hiding this comment

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

good point - @copilot make those single words localizeable as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in commit 99e653e. Created parameterized resource strings CmdProjectDescriptionFormat and CmdSolutionDescriptionFormat, and factory methods CommonOptions.ProjectOption(string verb) and CommonOptions.SolutionOption(string verb). Both test and run commands now use these shared methods with their respective verbs ("test" and "run").

Test command:

--project <PROJECT_PATH>    Defines the path of the project file to test. Use path to the project file, or 
                            path to the directory containing the project file. If not specified, it 
                            defaults to the current directory.

Run command:

--project <PROJECT_PATH>    Defines the path of the project file to run. Use path to the project file, or 
                            path to the directory containing the project file. If not specified, it 
                            defaults to the current directory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in commit d8074b5. Added localized verb resources VerbRun and VerbTest in CliCommandStrings.resx. Updated both test and run command parsers to use these localized strings instead of hardcoded "test" and "run".

Changes:

  • Created VerbRun and VerbTest resource strings
  • Updated MicrosoftTestingPlatformOptions to use CliCommandStrings.VerbTest
  • Updated RunCommandParser to use CliCommandStrings.VerbRun

The verbs are now properly localizable, ensuring consistent translations across all languages.

@Copilot Copilot AI changed the title Fix --project and --solution descriptions for dotnet test MTP to use "test" instead of "run" Fix --project and --solution descriptions for dotnet test MTP to use "test" instead of "run" and extract shared localization strings Oct 2, 2025
@Copilot Copilot AI requested a review from baronfel October 2, 2025 15:16
Copilot finished work on behalf of baronfel October 2, 2025 15:16
Copilot finished work on behalf of baronfel October 2, 2025 15:26
Comment on lines 552 to 554
<data name="CmdProjectDescription" xml:space="preserve">
<value>Defines the path of the project file to run (folder name or full path). If not specified, it defaults to the current directory.</value>
<value>Defines the path of the project file to run. Use path to the project file, or path to the directory containing the project file. If not specified, it defaults to the current directory.</value>
</data>
Copy link
Member

Choose a reason for hiding this comment

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

@copilot This resource is unused now? It can be deleted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed in commit cecdc27. Deleted both CmdProjectDescription and CommandOptionProjectDescription resources as they are no longer used after switching to the parameterized CmdProjectDescriptionFormat.

@Copilot Copilot AI requested a review from Youssef1313 October 2, 2025 15:54
Copilot finished work on behalf of Youssef1313 October 2, 2025 15:54
Copy link
Member

@Youssef1313 Youssef1313 left a comment

Choose a reason for hiding this comment

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

@copilot You need to also update:

  • test/dotnet.Tests/CompletionTests/snapshots/zsh/DotnetCliSnapshotTests.VerifyCompletions.verified.zsh
  • test/dotnet.Tests/CompletionTests/snapshots/pwsh/DotnetCliSnapshotTests.VerifyCompletions.verified.ps1

Specifically, change:

The path to the project file to run (defaults to the current directory if there is only one project).

to

Defines the path of the project file to run. Use path to the project file, or path to the directory containing the project file. If not specified, it defaults to the current directory.

Copy link
Contributor Author

Copilot AI commented Oct 3, 2025

@copilot You need to also update:

  • test/dotnet.Tests/CompletionTests/snapshots/zsh/DotnetCliSnapshotTests.VerifyCompletions.verified.zsh
    ...

Updated in commit 9b2267f. Both completion test snapshot files now use the new description format:

Old description:

The path to the project file to run (defaults to the current directory if there is only one project).

New description:

Defines the path of the project file to run. Use path to the project file, or path to the directory containing the project file. If not specified, it defaults to the current directory.

Changed in:

  • test/dotnet.Tests/CompletionTests/snapshots/zsh/DotnetCliSnapshotTests.VerifyCompletions.verified.zsh
  • test/dotnet.Tests/CompletionTests/snapshots/pwsh/DotnetCliSnapshotTests.VerifyCompletions.verified.ps1

Copilot finished work on behalf of Youssef1313 October 3, 2025 03:49
@Copilot Copilot AI requested a review from Youssef1313 October 3, 2025 03:49
@Youssef1313
Copy link
Member

@baronfel Is this good to merge?

@baronfel
Copy link
Member

baronfel commented Oct 3, 2025

@Youssef1313 it needs Tactics approval, so you'd need to send the mail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants