Document TestingPlatformCommandLineArguments for mixed frameworks/extensions#53371
Open
Evangelink wants to merge 5 commits intomainfrom
Open
Document TestingPlatformCommandLineArguments for mixed frameworks/extensions#53371Evangelink wants to merge 5 commits intomainfrom
Evangelink wants to merge 5 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR documents how to use TestingPlatformCommandLineArguments with MSBuild conditions so dotnet test works in solutions that mix test frameworks (for example, MSTest and xUnit.net) or have extensions enabled only in some projects.
Changes:
- Adds a new section to explain conditional routing patterns for framework-specific and extension-specific CLI options.
- Adds cross-links from troubleshooting, migration guidance, and
dotnet testMTP docs to the new section. - Fixes the
TestingPlatformCommandLineArgumentsproperty description and adds a cross-reference in MSBuild properties docs.
Show a summary per file
| File | Description |
|---|---|
| docs/core/tools/dotnet-test-mtp.md | Expands the TestingPlatformCommandLineArguments tip and links to the new mixed-framework guidance. |
| docs/core/testing/unit-testing-with-dotnet-test.md | Adds the main “mixed test frameworks/extensions” section with examples and scenarios. |
| docs/core/testing/migrating-vstest-microsoft-testing-platform.md | Adds a TIP pointing mixed-framework solutions to the new routing guidance. |
| docs/core/testing/microsoft-testing-platform-troubleshooting.md | Adds a troubleshooting entry for exit code 5 due to unrecognized options in mixed solutions. |
| docs/core/project-sdk/msbuild-props.md | Corrects the property description and adds a cross-reference to the new guidance. |
Copilot's findings
Comments suppressed due to low confidence (1)
docs/core/testing/unit-testing-with-dotnet-test.md:221
- The HangDump example conditions on
$(EnableHangDump) == 'true', but the snippet doesn't show whereEnableHangDumpis set totrue, and the sampledotnet testinvocation only setsHangDumpArgs. As written, the condition will evaluate to false andHangDumpArgswon't be appended. Consider updating the snippet/text to show settingEnableHangDumpin the projects that reference HangDump (or changing the condition to something that will actually be true based on package reference or another defined property).
To handle this case, condition the arguments on whether the extension's package is referenced. You can define a helper property in the project files that have the extension, and use that property as a condition:
```xml
<!-- In the .csproj files that reference HangDump (or via Directory.Build.targets) -->
<PropertyGroup Condition="'$(EnableHangDump)' == 'true'">
<TestingPlatformCommandLineArguments>$(TestingPlatformCommandLineArguments) $(HangDumpArgs)</TestingPlatformCommandLineArguments>
</PropertyGroup>
- Files reviewed: 5/5 changed files
- Comments generated: 3
Youssef1313
reviewed
Apr 24, 2026
ladeak
approved these changes
Apr 24, 2026
gewarren
approved these changes
Apr 24, 2026
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Youssef1313
reviewed
Apr 26, 2026
| |----------|---------------|-----------| | ||
| | Test filtering | `--filter <expression>` | `--filter-trait`, `--filter-class`, `--filter-method`, `--filter-query` | | ||
| | xUnit.net built-in reports | Not available | `--report-xunit-junit`, `--report-xunit-html`, `--report-xunit-trx` | | ||
| | Ignore zero tests | `--ignore-exit-code 8` | `--ignore-exit-code 8` | |
Member
There was a problem hiding this comment.
I don't get the point you're trying to make by this example.
Youssef1313
reviewed
Apr 26, 2026
|
|
||
| Each test project receives only the arguments relevant to its framework, and the other framework's arguments are never passed. | ||
|
|
||
| ### Common scenarios |
Member
There was a problem hiding this comment.
This whole "Common scenarios" section is too wordy IMO without giving user and more useful info. Everything seems to be well explained from previous.
Youssef1313
reviewed
Apr 26, 2026
Co-authored-by: Youssef Victor <youssefvictor00@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Document how to use
TestingPlatformCommandLineArgumentswith MSBuild conditions to avoid unrecognized CLI option errors when runningdotnet teston solutions that mix test frameworks (for example, MSTest and xUnit.net) or reference different sets of extensions (for example, HangDump on only some projects).Closes microsoft/testfx#7773
Changes
Main content (single source of truth)
TestingPlatformCommandLineArgumentswithUsingMSTestSdkconditiondotnet test -p:invocation exampleCross-references
--filtermigration sectionTestingPlatformCommandLineArgumentstipContent source
All content is based on the discussion in microsoft/testfx#7773 (adapted, not copied verbatim). Expert review is recommended for the MSBuild condition patterns.
Internal previews