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. Added snapshot test for MTP help output to ensure the help text is correctly rendered and verified in future changes.

Risk

Low - only updates CLI description strings and adds test coverage.

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. Added MTPHelpSnapshotTests to capture and verify MTP help output (Linux snapshot)
  9. 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
  • ✅ MTP help output snapshot test passes on Linux (macOS and Windows snapshots to be added separately)

The changes are minimal and focused, affecting only the description strings and adding test coverage without altering any functionality.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@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 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

@baronfel
Copy link
Member

baronfel commented Oct 7, 2025

@copilot we need a new snapshot test that creates snapshots of help output for the dotnet test command in MTP mode, not in VSTest mode. please create one following the patterns and standards that already exist, run the tests on linux, and add the generated linux snapshots to the repo. We'll have to add the macos and windows snapshots after you commit.

Copy link
Contributor Author

Copilot AI commented Oct 7, 2025

@copilot we need a new snapshot test that creates snapshots of help output for the dotnet test command in MTP mode, not in VSTest mode. please create one following the patterns and standards tha...

Created in commit bf21991. Added MTPHelpSnapshotTests with a snapshot test that verifies the dotnet test help output in MTP mode.

Test details:

  • Test file: test/dotnet.Tests/CommandTests/Test/MTPHelpSnapshotTests.cs
  • Linux snapshot: test/dotnet.Tests/CommandTests/Test/snapshots/MTPHelpSnapshotTests.VerifyMTPHelpOutput.verified.txt
  • The test uses the existing TestProjectSolutionWithTestsAndArtifacts test asset which has MTP configured via global.json
  • Test passes on Linux

The snapshot captures the complete MTP help output including:

  • Options section with --project and --solution showing the updated descriptions
  • Platform Options section
  • Extension Options section

As you noted, macOS and Windows snapshots will need to be added separately after this commit.

@Copilot Copilot AI requested a review from baronfel October 7, 2025 14:54
Copilot finished work on behalf of baronfel October 7, 2025 14:54
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